Skip to content

Commit

Permalink
bump to 1.4.1rc0
Browse files Browse the repository at this point in the history
  • Loading branch information
Bob Bui committed Jul 9, 2021
1 parent 8d6c1dd commit 22f4c47
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 34 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
The format is based on [Keep a Changelog](http://keepachangelog.com/).

## 1.4.1rc0 - 2021-04-23

- fix #77 Implement extra properties from json-logging-py

## 1.4.0rc2 - 2021-04-23

- allow overriding of correlation id
Expand Down
41 changes: 8 additions & 33 deletions example/flask_sample_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,14 @@

app = flask.Flask(__name__)
json_logging.init_flask(enable_json=True)
json_logging.init_request_instrument(app, exclude_url_patterns=[r'/exclude_from_request_instrumentation'])
json_logging.init_request_instrument(
app, exclude_url_patterns=[r'/ready', r'/alive'])

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

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

@app.route('/')
def home():
logger.info("test log statement")
logger.info("test log statement with extra props", extra={'props': {"extra_property": 'extra_value'}})
logger.info("test log statement with custom correlation id", extra={'props': {'correlation_id': 'custom_correlation_id'}})

correlation_id = json_logging.get_correlation_id()
return "hello world" \
"\ncorrelation_id : " + correlation_id


@app.route('/exception')
def exception():
try:
raise RuntimeError
except BaseException as e:
logger.error("Error occurred", exc_info=e)
logger.exception("Error occurred", exc_info=e)
return "Error occurred, check log for detail"


@app.route('/exclude_from_request_instrumentation')
def exclude_from_request_instrumentation():
return "this request wont log request instrumentation information"


if __name__ == "__main__":
app.run(host='0.0.0.0', port=int(5000), use_reloader=False)
client = MongoClient(app.config["MONGO_URI"])
app.logger.debug(client.server_info())
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

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

0 comments on commit 22f4c47

Please sign in to comment.