logging
get_console_handler()
Instanciates the logging output on the console.
Source code in src/dxtr/utils/logging.py
45 46 47 48 49 50 | |
get_file_handler(log_file, log_level=DEFAULT_LOG_LEVEL_FILE, time_rotating=True)
Instanciate the logging output written on disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
log_file
|
str
|
The file where to store the log. |
required |
log_level
|
str
|
The log level to save on file. |
DEFAULT_LOG_LEVEL_FILE
|
time_rotating
|
bool
|
If True, a time-rotating managment of log files is set. |
True
|
Returns:
| Type | Description |
|---|---|
file_handler
|
The object that manages all the log messages. |
Notes
- If time-rotation is used
- One file is generated per day, starting at midnight.
- At most, 5 files are stored on disk. Meaning that we conserve at most a week of log.
Source code in src/dxtr/utils/logging.py
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 85 86 87 88 89 | |
get_logger(logger_name, log_file=None, log_level=DEFAULT_LOG_LEVEL_CNSL)
Instanciates the two logging outputs: console & file on disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
logger_name
|
str
|
The name given to the created Logger object. |
required |
log_file
|
Optional[str]
|
Optional, default is None. The path to the file where to write the log. |
None
|
log_level
|
Optional, default is 'INFO'. The log level for the console output. |
DEFAULT_LOG_LEVEL_CNSL
|
Returns:
| Type | Description |
|---|---|
The Logger object gathering all the info.
|
|
Source code in src/dxtr/utils/logging.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
mutelogging(func)
Increases momentary the logging level so no info are displayed.
Source code in src/dxtr/utils/logging.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | |
require_pyvista(func)
Checks if the library pyvista is installed.
Notes
- This library is an optional dependency.
- It is used in the visu and io modules.
- In the io module it is required for recording
Cochain. - The dependency to logger does not seem super clean... Maybe this means that this decorator does not belong here...
Source code in src/dxtr/utils/logging.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | |