modular_trader.logging#
Submodules#
Classes#
Base class for loggers. |
|
A logger that logs messages to a file. |
Package Contents#
- class modular_trader.logging.BaseLogger(logger: loguru._logger.Logger = logger)#
Base class for loggers.
- Attributes:
logger (loguru.Logger): The logger to use.
- Parameters:
logger (loguru._logger.Logger)
- critical(message: str, *args, **kwargs) None #
Logs a message at the critical level.
- Args:
message (str): The message to log. *args: Additional positional arguments. **kwargs: Additional keyword arguments.
- Parameters:
message (str)
- Return type:
None
- debug(message: str, *args, **kwargs) None #
Logs a message at the debug level.
- Args:
message (str): The message to log. *args: Additional positional arguments. **kwargs: Additional keyword arguments.
- Parameters:
message (str)
- Return type:
None
- error(message: str, *args, **kwargs) None #
Logs a message at the error level.
- Args:
message (str): The message to log. *args: Additional positional arguments. **kwargs: Additional keyword arguments.
- Parameters:
message (str)
- Return type:
None
- exception(message: str, *args, **kwargs) None #
Logs an exception at the error level.
- Args:
message (str): The message to log. *args: Additional positional arguments. **kwargs: Additional keyword arguments.
- Parameters:
message (str)
- Return type:
None
- info(message: str, *args, **kwargs) None #
Logs a message at the info level.
- Args:
message (str): The message to log. *args: Additional positional arguments. **kwargs: Additional keyword arguments.
- Parameters:
message (str)
- Return type:
None
- success(message: str, *args, **kwargs) None #
Logs a message at the success level.
- Args:
message (str): The message to log. *args: Additional positional arguments. **kwargs: Additional keyword arguments.
- Parameters:
message (str)
- Return type:
None
- trace(message: str, *args, **kwargs) None #
Logs a message at the trace level.
- Args:
message (str): The message to log. *args: Additional positional arguments. **kwargs: Additional keyword arguments.
- Parameters:
message (str)
- Return type:
None
- warning(message: str, *args, **kwargs) None #
Logs a message at the warning level.
- Args:
message (str): The message to log. *args: Additional positional arguments. **kwargs: Additional keyword arguments.
- Parameters:
message (str)
- Return type:
None
- logger#
- class modular_trader.logging.TradingLogger(logger: loguru._logger.Logger = logger)#
Bases:
modular_trader.logging.base.BaseLogger
A logger that logs messages to a file.
This logger logs messages to a file. The file will be rotated when it reaches a certain size, and old files will be deleted after a certain number of days.
- Attributes:
logger (Logger): The underlying logger. file_path (os.PathLike): The path to the log file. rotation_size_mb (int): The maximum size of the log file before it is
rotated. If
None
, the file will not be rotated.- retention_days (int): The number of days to keep old log files. If
None
, old files will not be deleted.
- Parameters:
logger (loguru._logger.Logger)
- __post_init__()#
- file_path: os.PathLike = None#
- logger: loguru._logger.Logger = None#
- retention_days: int = None#
- rotation_size_mb: int = None#