Skip to content

Conversation

dave-shawley
Copy link
Member

This PR adds a new module that will build logging.config.dictConfig ready dictionaries for services and command-line applications. jsonscribe.get_service_configuration returns a dictionary that is wired to use JSON-based logging and jsonscribe.get_cli_configuration returns a similar dictionary that produces human-readable logs.

Both functions respond to the DEBUG and LOG_FORMAT environment variables. If DEBUG is set and determined to be truthy, then the root log level is set to debug instead of info (the default). The LOG_FORMAT environment variable can be set to either json or plain to explicitly select a format regardless of what the application has configured. The functions both support parameters that can be used to influence the decision as well though the options probably won't see much use.

@dave-shawley dave-shawley force-pushed the log-format branch 2 times, most recently from e14c267 to 6abc3a4 Compare October 26, 2021 17:24
@codecov
Copy link

codecov bot commented Oct 26, 2021

Codecov Report

Merging #2 (2fe10fb) into main (cc5ea2e) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##              main        #2   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         5    +1     
  Lines           71       116   +45     
  Branches        11        19    +8     
=========================================
+ Hits            71       116   +45     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
jsonscribe/__init__.py 100.00% <100.00%> (ø)
jsonscribe/config.py 100.00% <100.00%> (ø)
jsonscribe/utils.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cc5ea2e...2fe10fb. Read the comment docs.

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.

1 participant