Skip to content

Commit 22f4c47

Browse files
author
Bob Bui
committed
bump to 1.4.1rc0
1 parent 8d6c1dd commit 22f4c47

File tree

3 files changed

+13
-34
lines changed

3 files changed

+13
-34
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
55
This project adheres to [Semantic Versioning](http://semver.org/).
66
The format is based on [Keep a Changelog](http://keepachangelog.com/).
77

8+
## 1.4.1rc0 - 2021-04-23
9+
10+
- fix #77 Implement extra properties from json-logging-py
11+
812
## 1.4.0rc2 - 2021-04-23
913

1014
- allow overriding of correlation id

example/flask_sample_app.py

+8-33
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,14 @@
77

88
app = flask.Flask(__name__)
99
json_logging.init_flask(enable_json=True)
10-
json_logging.init_request_instrument(app, exclude_url_patterns=[r'/exclude_from_request_instrumentation'])
10+
json_logging.init_request_instrument(
11+
app, exclude_url_patterns=[r'/ready', r'/alive'])
1112

12-
# init the logger as usual
13-
logger = logging.getLogger("test logger")
14-
logger.setLevel(logging.DEBUG)
15-
logger.addHandler(logging.StreamHandler(sys.stdout))
13+
app.logger.setLevel(logging.getLevelName(env.get('LOGLEVEL', 'INFO').upper()))
14+
app.logger.addHandler(logging.StreamHandler(sys.stdout))
15+
app.logger.removeHandler(default_handler)
1616

17+
app.config["MONGO_URI"] = env.get("MONGO_DSN")
1718

18-
@app.route('/')
19-
def home():
20-
logger.info("test log statement")
21-
logger.info("test log statement with extra props", extra={'props': {"extra_property": 'extra_value'}})
22-
logger.info("test log statement with custom correlation id", extra={'props': {'correlation_id': 'custom_correlation_id'}})
23-
24-
correlation_id = json_logging.get_correlation_id()
25-
return "hello world" \
26-
"\ncorrelation_id : " + correlation_id
27-
28-
29-
@app.route('/exception')
30-
def exception():
31-
try:
32-
raise RuntimeError
33-
except BaseException as e:
34-
logger.error("Error occurred", exc_info=e)
35-
logger.exception("Error occurred", exc_info=e)
36-
return "Error occurred, check log for detail"
37-
38-
39-
@app.route('/exclude_from_request_instrumentation')
40-
def exclude_from_request_instrumentation():
41-
return "this request wont log request instrumentation information"
42-
43-
44-
if __name__ == "__main__":
45-
app.run(host='0.0.0.0', port=int(5000), use_reloader=False)
19+
client = MongoClient(app.config["MONGO_URI"])
20+
app.logger.debug(client.server_info())

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
setup(
1414
name="json-logging",
15-
version='1.4.0-rc2',
15+
version='1.4.1-rc0',
1616
packages=find_packages(exclude=['contrib', 'docs', 'tests*', 'example', 'dist', 'build']),
1717
license='Apache License 2.0',
1818
description="JSON Python Logging",

0 commit comments

Comments
 (0)