flambe.logging.handler.contextual_file
¶
Module Contents¶
-
class
flambe.logging.handler.contextual_file.
ContextualFileHandler
(canonical_name: str, mode: str = 'a', encoding=None)[source]¶ Bases:
logging.FileHandler
Uses the record current_log_dir value to customize file path
Uses the LogRecord object’s current_log_dir value to dynamically determine a path for the output file name. Functions the same as parent logging.FileHandler but always writes to the file given by current_log_dir + canonical_name.
Parameters: - canonical_name (str) – Common name for each file
- mode (str) – See built-in open description of mode
- encoding (type) – See built-in open description of encoding
-
current_log_dir
¶ Most recently used prefix in an incoming LogRecord
Type: str
-
canonical_name
¶ Common name for each file
Type: str
-
mode
¶ See built-in open description of mode
Type: str
-
delay
¶ If true will delay opening of file until first use
Type: type
-
stream
¶ Currently open file stream for writing logs - should match the file indicated by base_path + current_prefix + canonical_name
Type: type
-
encoding
¶ See built-in open description of encoding
-
emit
(self, record: logging.LogRecord)[source]¶ Emit a record
If the stream is invalidated by a new record prefix value it will be closed and set to None before calling the super emit which will handle opening a new stream to baseFilename
Parameters: record (logging.LogRecord) – Record to be saved at _console_log_dir Returns: Return type: None