Logging Utilities¶
dnallm.utils.logger ¶
DNALLM Logging Configuration
This module provides a centralized logging configuration for the DNALLM project. It replaces print statements with proper logging for better production readiness.
Classes¶
ColoredFormatter ¶
Bases: Formatter
Custom formatter with colored output for console.
Functions¶
format ¶
format(record)
Format log record with colors.
Source code in dnallm/utils/logger.py
122 123 124 125 126 | |
DNALLMLogger ¶
DNALLMLogger(name='dnallm', level='INFO')
Centralized logger for DNALLM with colored output and structured logging.
Initialize the DNALLM logger.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Logger name |
'dnallm'
|
level
|
str
|
Logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL) |
'INFO'
|
Source code in dnallm/utils/logger.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 | |
Functions¶
critical ¶
critical(message, **kwargs)
Log critical message.
Source code in dnallm/utils/logger.py
82 83 84 | |
debug ¶
debug(message, **kwargs)
Log debug message.
Source code in dnallm/utils/logger.py
66 67 68 | |
error ¶
error(message, **kwargs)
Log error message.
Source code in dnallm/utils/logger.py
78 79 80 | |
failure ¶
failure(message, **kwargs)
Log failure message with red color.
Source code in dnallm/utils/logger.py
92 93 94 | |
info ¶
info(message, **kwargs)
Log info message.
Source code in dnallm/utils/logger.py
70 71 72 | |
info_icon ¶
info_icon(message, **kwargs)
Log info message with cyan color and icon.
Source code in dnallm/utils/logger.py
106 107 108 | |
progress ¶
progress(message, **kwargs)
Log progress message with blue color.
Source code in dnallm/utils/logger.py
96 97 98 | |
success ¶
success(message, **kwargs)
Log success message with green color.
Source code in dnallm/utils/logger.py
86 87 88 89 90 | |
warning ¶
warning(message, **kwargs)
Log warning message.
Source code in dnallm/utils/logger.py
74 75 76 | |
warning_icon ¶
warning_icon(message, **kwargs)
Log warning message with yellow color and icon.
Source code in dnallm/utils/logger.py
100 101 102 103 104 | |
LoggingContext ¶
LoggingContext(level)
Context manager for temporary logging level changes.
Source code in dnallm/utils/logger.py
215 216 217 | |
Functions¶
get_logger ¶
get_logger(name='dnallm', level='INFO')
Get or create a logger instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Logger name |
'dnallm'
|
level
|
str
|
Logging level |
'INFO'
|
Returns:
| Type | Description |
|---|---|
DNALLMLogger
|
DNALLMLogger instance |
Source code in dnallm/utils/logger.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |
log_debug ¶
log_debug(message)
Log debug message.
Source code in dnallm/utils/logger.py
191 192 193 | |
log_error ¶
log_error(message)
Log error message.
Source code in dnallm/utils/logger.py
181 182 183 | |
log_failure ¶
log_failure(message)
Log failure message.
Source code in dnallm/utils/logger.py
201 202 203 | |
log_function_call ¶
log_function_call(func)
Decorator to log function calls.
Source code in dnallm/utils/logger.py
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | |
log_info ¶
log_info(message)
Log info message.
Source code in dnallm/utils/logger.py
176 177 178 | |
log_progress ¶
log_progress(message)
Log progress message.
Source code in dnallm/utils/logger.py
206 207 208 | |
log_success ¶
log_success(message)
Log success message.
Source code in dnallm/utils/logger.py
196 197 198 | |
log_warning ¶
log_warning(message)
Log warning message.
Source code in dnallm/utils/logger.py
186 187 188 | |
setup_logging ¶
setup_logging(level='INFO', log_file=None)
Set up logging configuration for the entire application.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
level
|
str
|
Logging level |
'INFO'
|
log_file
|
str | None
|
Optional log file path |
None
|
Source code in dnallm/utils/logger.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | |