crossbar._logging¶
Attributes¶
Classes¶
An object which encapsulates a JSON-dumpable item, and will colorise it |
|
A context manager that captures logs inside of it, and makes it available |
|
Functions¶
|
Given an already formatted JSON string, return a colored variant which will |
|
Escape things that would otherwise confuse .format. |
|
Make an observer which writes JSON to C{outfile}. |
|
Make an observer that writes out to C{path}. |
|
Create an observer which prints logs to L{sys.stderr}. |
|
Create an observer which prints logs to L{sys.stdout}. |
|
Strip ANSI codes. |
Module Contents¶
- class JSON(item)[source]¶
Bases:
objectAn object which encapsulates a JSON-dumpable item, and will colorise it when it is __str__’d.
- class LogCapturer(level='debug')[source]¶
Bases:
objectA context manager that captures logs inside of it, and makes it available through the logs attribute, or the get_category method.
- color_json(json_str)[source]¶
Given an already formatted JSON string, return a colored variant which will produce colored output on terminals.
- make_logfile_observer(path, show_source=False)[source]¶
Make an observer that writes out to C{path}.
- make_stderr_observer(levels=(LogLevel.warn, LogLevel.error, LogLevel.critical), show_source=False, format='standard', color=False, _file=None, _categories=None)[source]¶
Create an observer which prints logs to L{sys.stderr}.