You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I took the example code from here and put some boilerplate code around it:
fromlithoxylimportLoggerapp_log=Logger("myapp")
fromlithoxylimport (SensibleFilter,
SensibleFormatter,
StreamEmitter,
SensibleSink)
# Create a filter that controls output verbosityfltr=SensibleFilter(success='critical',
failure='info',
exception='debug')
# Create a simple formatter with just two bits of info:# The time since startup/import and end event message.# These are just two of the built-in "fields",# and the syntax is new-style string formatting syntax.fmtr=SensibleFormatter('+{import_delta_s} - {end_message}')
# Create an emitter to write to stderr. 'stdout' and open file objects# also behave predictably.emtr=StreamEmitter('stderr')
# Tie them all together. Note that filters accepts an iterablesink=SensibleSink(filters=[fltr], formatter=fmtr, emitter=emtr)
# Add the sink to app_log, a vanilla Logger created aboveapp_log.add_sink(sink)
withapp_log.info("Main code"):
pass
The resulting code, when run, produces no output. It doesn't matter if I use app_log.critical, still no output.
It's quite possible I'm doing something wrong here - I could find no "complete" examples of how to use SensibleSink - but at a minimum I think the documentation should include a fully working example.
This is using Python 3.9 on Windows 10, with the version of lithoxy from PyPI (20.0.0) in case it matters. I also tried with Python 3.8 and 3.7, just in case, and got the same result.
The text was updated successfully, but these errors were encountered:
I took the example code from here and put some boilerplate code around it:
The resulting code, when run, produces no output. It doesn't matter if I use
app_log.critical
, still no output.It's quite possible I'm doing something wrong here - I could find no "complete" examples of how to use
SensibleSink
- but at a minimum I think the documentation should include a fully working example.This is using Python 3.9 on Windows 10, with the version of lithoxy from PyPI (20.0.0) in case it matters. I also tried with Python 3.8 and 3.7, just in case, and got the same result.
The text was updated successfully, but these errors were encountered: