MCPcopy
hub / github.com/StackStorm/st2 / decorate_logger_methods

Function decorate_logger_methods

st2common/st2common/log.py:171–188  ·  view source on GitHub ↗

Decorate all the logger methods so all the keys in the extra dictionary are automatically prefixed with an underscore to avoid clashes with standard log record attributes.

(logger)

Source from the content-addressed store, hash-verified

169
170
171def decorate_logger_methods(logger):
172 """
173 Decorate all the logger methods so all the keys in the extra dictionary are
174 automatically prefixed with an underscore to avoid clashes with standard log
175 record attributes.
176 """
177
178 # Note: We override findCaller with our custom implementation which takes into account this
179 # module.
180 # This way filename, module, funcName and lineno LogRecord attributes contain correct values
181 # instead of all pointing to decorate_log_method.
182 logger.findCaller = find_caller
183 for key in LOGGER_KEYS:
184 log_method = getattr(logger, key)
185 log_method = decorate_log_method(log_method)
186 setattr(logger, key, log_method)
187
188 return logger
189
190
191def getLogger(name):

Callers 1

getLoggerFunction · 0.85

Calls 1

decorate_log_methodFunction · 0.85

Tested by

no test coverage detected