Skip to content

LoggerConfig

LoggerConfig.Configuration(file: bool = "False, level: str = "info", file_path: str=None, file_mode: str = 'a')

Description

Configure logging for the application based on user preferences or defaults.

Parameters

file: (bool) If True, logs will be written to a file. If False, logs will be written to stdout.

level: (str) Desired log level. Valid values are 'debug', 'info', 'warning', 'error', 'critical'.

file_path: (str) The full path where the log file will be saved. Defaults to 'hdforce.log' in the current project directory.

file_mode: (str) Mode to open the log file, default is 'a'. Options are 'a' (append) and 'w'(overwrite)

Raises

Value Error

  • If invalid option for level.

Example

Create Log File At Lowest Level
from hdforce import LoggerConfig

LoggerConfig.Configuration(file = True, level = "debug")