Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local development server to log on stdout #186

Merged
merged 1 commit into from
Dec 27, 2016
Merged

Local development server to log on stdout #186

merged 1 commit into from
Dec 27, 2016

Conversation

arundhaj
Copy link
Contributor

When running chalice local server, this change would enable the app to log in stdout.

The following code that logs in CloudWatch when running on AWS Lambda, will also work during local.

import logging

logger = logging.getLogger()
logger.setLevel(logging.INFO)

@app.route('/')
def index():
    logger.info('Log in stdout when local and in CloudWatch on AWS Lambda')
    return {'hello': 'world'}

@jamesls
Copy link
Member

jamesls commented Dec 27, 2016

Thanks for the pull request. I made one small change and moved this logic out of module scope and into the local function in chalice.cli. Otherwise looks good.

@jamesls jamesls merged commit 3732c08 into aws:master Dec 27, 2016
jamesls added a commit that referenced this pull request Dec 27, 2016
Closes #186.

* arundhaj-local-logging:
  Move local log config over to cli module
  Local development server to log on stdout
jamesls added a commit that referenced this pull request Dec 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants