logger_
CoreLogger
A singleton logging class for consistent logging across an application.
Provides the flexibility to initialize with console and rotating file handlers.
Source code in libs\cafex_core\src\cafex_core\logging\logger_.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
__init__(name, level=logging.INFO)
Initializes the logging instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the logging. |
required |
level
|
int
|
The logging level. Defaults to logging.INFO. |
INFO
|
Source code in libs\cafex_core\src\cafex_core\logging\logger_.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |
__new__(*args, **kwargs)
Enforces the singleton pattern.
Returns:
| Name | Type | Description |
|---|---|---|
SingletonLogger |
The single instance of the logging class. |
Source code in libs\cafex_core\src\cafex_core\logging\logger_.py
16 17 18 19 20 21 22 23 24 | |
get_logger()
Returns the logging instance.
Returns:
| Type | Description |
|---|---|
|
logging.Logger: The configured logging object. |
Source code in libs\cafex_core\src\cafex_core\logging\logger_.py
78 79 80 81 82 83 84 | |
initialize(console_logging, file_path, worker_id='master')
Initializes the logging with console and/or file handlers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
console_logging
|
bool
|
Whether to enable console logging. Defaults to True. |
required |
file_path
|
str
|
The path to the log file. Defaults to "app.log". |
required |
worker_id
|
str
|
worker id (gwo, gw1) - master in case of non-parallel. |
'master'
|
Source code in libs\cafex_core\src\cafex_core\logging\logger_.py
41 42 43 44 45 46 47 48 49 50 51 52 53 | |