All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
-
Added a new
JsonLogger
class that logs messages in JSON format. Supports child loggers as well. The logger inherits from builtinlogging.Logger
and the log methods have the same API as the builtin as well. Example usage:from lifeomic_logging import JsonLogger # Create a logger with a name and optional context that will be included # on all log messages. logger = JsonLogger("my-logger", {"foo": "bar"}) logger.info({"msg": "message", "isTrue": True}) # >>> {"name": "my-logger", "foo": "bar", "level": "INFO", "msg": "message", "isTrue": true} child_logger = logger.child({"fizz": "buzz"}) child.info("message") # >>> {"name": "my-logger", "foo": "bar", "fizz": "buzz", "level": "INFO", "msg": "message"}