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
|
separator |
bool
|
Whether to enable a separator between log messages.
Defaults to |
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. |
get_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
|
separator |
bool
|
Whether to enable a separator between log messages.
Defaults to |
False
|
Returns:
| Type | Description |
|---|---|
Logger
|
logging.Logger: The custom logger. |