-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
closes #1: Found that gunicorn logger not passed in logging object, b…
…ut as data in event dict.
- Loading branch information
Showing
6 changed files
with
61 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import structlog | ||
import structlog_extensions | ||
|
||
# --- Structlog logging initialisation code | ||
|
||
pre_chain = [ | ||
# Add the log level and a timestamp to the event_dict if the log entry | ||
# is not from structlog. | ||
structlog.stdlib.add_log_level, | ||
structlog.stdlib.add_logger_name, | ||
structlog_extensions.processors.CombinedLogParser("gunicorn.access") | ||
] | ||
|
||
logconfig_dict = { | ||
"version": 1, | ||
"disable_existing_loggers": False, | ||
"formatters": { | ||
"json_formatter": { | ||
"()": structlog.stdlib.ProcessorFormatter, | ||
"processor": structlog.processors.JSONRenderer(), | ||
"foreign_pre_chain": pre_chain, | ||
} | ||
}, | ||
"handlers": { | ||
"error_console": { | ||
"class": "logging.StreamHandler", | ||
"formatter": "json_formatter", | ||
}, | ||
"console": { | ||
"class": "logging.StreamHandler", | ||
"formatter": "json_formatter", | ||
} | ||
}, | ||
} | ||
|
||
accesslog = '-' | ||
errorlog = '-' | ||
bind = '0.0.0.0:5000' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from flask import Flask | ||
app = Flask(__name__) | ||
|
||
|
||
@app.route('/') | ||
def hello_world(): | ||
return 'Hello, World!' | ||
|
||
if __name__ == '__main__': | ||
app.run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from .app import app | ||
|
||
if __name__ == "__main__": | ||
app.run() |