Skip to content

fxlog

FXFormatter

Bases: Formatter

Custom log formatter that adds color to log messages based on the log level.

Parameters:

Name Type Description Default
fmt str

The log message format string.

None
datefmt str

The date format string.

None
style str

The format style.

'{'
color bool

Whether to enable color logging. Defaults to False.

False
separator bool

Whether to enable a separator between log messages. Defaults to False.

False

Attributes:

Name Type Description
LEVEL_COLORS dict

A dictionary mapping log levels to their respective color codes.

color bool

Whether to enable color logging.

separator bool

Whether to enable a separator between log messages.

FXTimedRotatingFileHandler

Bases: TimedRotatingFileHandler

Custom log file handler that rotates log files at midnight.

Attributes:

Name Type Description
suffix str

The suffix to append to the rotated log file.

clear_logs

clear_logs() -> None

Clears the fxquinox log files.

get_logger

get_logger(
    logger_name: str, color: bool = True, separator: bool = False
) -> Logger

Creates a custom logger with the specified name and returns it.

Parameters:

Name Type Description Default
logger_name str

The name of the logger.

required
color bool

Whether to enable color logging. Defaults to True.

True
separator bool

Whether to enable a separator between log messages. Defaults to False.

False

Returns:

Type Description
Logger

logging.Logger: The custom logger.

set_log_level

set_log_level(level: int) -> None

Sets the logging level for all instances of loggers created by the FXFormatter class.

Parameters:

Name Type Description Default
level int

The logging level to set.

required