flambe.logging.logging

Module Contents

flambe.logging.logging.MB[source]
flambe.logging.logging.setup_global_logging(console_log_level: int = logging.NOTSET) → None[source]

Set up flambe logging with a Stream handler and a Rotating File handler.

This method should be set before consuming any logger as it sets the basic configuration for all future logs.

After executing this method, all loggers will have the following handlers: * Stream handler: prints to std output all logs that above The console_log_level * Rotating File hanlder: 10MB log file located in Flambe global folder. Configured to store all logs (min level DEBUG)

Parameters:console_log_level (int) – The minimum log level for the Stream handler
class flambe.logging.logging.FlambeFilter[source]

Bases: logging.Filter

Filter all log records that don’t come from flambe or main.

filter(self, record: logging.LogRecord)[source]
class flambe.logging.logging.TrialLogging(log_dir: str, verbose: bool = False, root_log_level: Optional[int] = None, capture_warnings: bool = True, console_prefix: Optional[str] = None, hyper_params: Optional[Dict] = None)[source]
__enter__(self)[source]
__exit__(self, exc_type: Any, exc_value: Any, traceback: Any)[source]

Close the listener and restore original logging config

class flambe.logging.logging.ContextInjection(**attrs)[source]

Add specified attributes to all log records

Parameters:**attrs (Any) – Attributes that should be added to all log records, for use in downstream handlers
filter(self, record: logging.LogRecord)[source]
__call__(self, record: logging.LogRecord)[source]
class flambe.logging.logging.TqdmFileWrapper(file: Any)[source]

Dummy file-like that will write to tqdm

Based on canoncial tqdm example

write(self, x: AnyStr)[source]
flush(self)[source]
flambe.logging.logging.colorize_exceptions() → None[source]

Colorizes the system stderr ouput using pygments if installed