scenario.logextradata module¶
Logging extra data handling.
- class LogExtraData¶
Bases:
StrEnum
Keys to can be used in the dictionary passed on in the
extra
parameter of the standardlogging
functions.- CURRENT_LOGGER = '_logger_'¶
Current logger reference.
Stores a class:.logger.Logger instance reference.
Automatically set by
LoggerLogFilter
so thatLogFormatter
knows about the currentLogger
instance when processing the log event.
- LONG_TEXT_MAX_LINES = '_long_text_max_lines_'¶
Long text mode option.
When set, activates the long text mode.
int
that gives the maximum number of lines to display.
- DATE_TIME = '_date_time_'¶
Extra flag: Should date/time be displayed?
True
by default.Still depends on usual
logging
configurations.
- COLOR = '_color_'¶
Extra flag: May color be used? (console only)
True
by default.Still depends on usual
logging
configurations.
- LOG_LEVEL = '_log_level_'¶
Extra flag: Should the log level be displayed?
True
by default.
- SCENARIO_STACK_INDENTATION = '_scenario_stack_indentation_'¶
Extra flag: Should the scenario stack indentation be displayed?
True
by default.
- MAIN_LOGGER_INDENTATION = '_main_logger_indentation_'¶
Extra flag: Should the main logger indentation be displayed?
True
by default.
- CLASS_LOGGER_INDENTATION = '_class_logger_indentation_'¶
Extra flag: Should the main logger indentation be displayed?
True
by default.
- ACTION_RESULT_MARGIN = '_action_result_margin_'¶
Extra flag: Should the log be applied a margin that makes it indented within the action/result block it belongs to?
True
by default.
- static extradata(extra)¶
Translates a {ExtraFlag: Any} dictionary into a
logging
compatible dictionary.The resulting dictionary basically deserves the
extra
parameter oflogging
functions.- Parameters:
extra – Enum dictionary to translate.
- Returns:
logging
compatible dictionary.
- static get(record, key)¶
Retrieves extra data from a record.
- Parameters:
record – Record to look for extra data in.
key – Extra data name to look for.
- Returns:
Extra data value if set, or
None
otherwise.
- static set(record, key, value)¶
Sets extra data with a record.
- Parameters:
record – Record to store extra data in.
key – Extra data name to set.
value – Extra data value.