thinlog.handlers.ctx_print module

thinlog.handlers.ctx_print module#

Handler that prints a record’s context attribute as JSON to stdout.

class thinlog.handlers.ctx_print.CtxPrintHandler(level=0)[source]#

Bases: Handler

Print the context attribute of a log record as JSON to stdout.

If the record has no context attribute the handler silently does nothing. Useful for debugging context filters during development.

emit(record: LogRecord) None[source]#

Print record.context as a JSON string.