trestle.common.log
trestle.common.log ¤
Common logging utilities.
Classes¤
SpecificLevelFilter ¤
Bases: Filter
Filter for the same level as provided by setLevel for a log handler.
Python by default logs all levels above to a given destination. This makes it easy to split levels where you might log all levels to file and only errors to std.err, however, does not allow logging a specific level elsewhere.
Source code in trestle/common/log.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |
Functions¤
__init__(level) ¤
Initialize providing maximum level to be pushed through the filter.
Source code in trestle/common/log.py
37 38 39 | |
filter(log_record) ¤
Filter log messages.
Source code in trestle/common/log.py
41 42 43 | |
Trace ¤
Class allowing low priority trace message when verbose > 1 and log level below DEBUG.
Source code in trestle/common/log.py
114 115 116 117 118 119 120 121 122 123 124 125 | |
Functions¤
__init__(logger) ¤
Store the main logger with its module name.
Source code in trestle/common/log.py
117 118 119 | |
log(msg) ¤
Output the trace msg if log level is below DEBUG.
Source code in trestle/common/log.py
121 122 123 124 125 | |
Functions¤
get_current_verbosity_level(logger) ¤
Get the current verbosity level based on logging level.
Source code in trestle/common/log.py
104 105 106 107 108 109 110 111 | |
set_global_logging_levels(level=logging.INFO) ¤
Initialise logging.
Should only be invoked by the CLI classes or similar.
Source code in trestle/common/log.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |
set_log_level_from_args(args) ¤
Vanity function to automatically set log levels based on verbosity flags.
Source code in trestle/common/log.py
92 93 94 95 96 97 98 99 100 101 | |
handler: python