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.
Methods:¶
format ¶
format(record)
Format log record with colors.
Source code in dnallm/utils/logger.py
121 122 123 124 125 | |
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 39 40 41 42 | |
Methods:¶
critical ¶
critical(message, **kwargs)
Log critical message.
Source code in dnallm/utils/logger.py
85 86 87 | |
debug ¶
debug(message, **kwargs)
Log debug message.
Source code in dnallm/utils/logger.py
69 70 71 | |
error ¶
error(message, **kwargs)
Log error message.
Source code in dnallm/utils/logger.py
81 82 83 | |
failure ¶
failure(message, **kwargs)
Log failure message with red color.
Source code in dnallm/utils/logger.py
93 94 95 | |
info ¶
info(message, **kwargs)
Log info message.
Source code in dnallm/utils/logger.py
73 74 75 | |
info_icon ¶
info_icon(message, **kwargs)
Log info message with cyan color and icon.
Source code in dnallm/utils/logger.py
105 106 107 | |
progress ¶
progress(message, **kwargs)
Log progress message with blue color.
Source code in dnallm/utils/logger.py
97 98 99 | |
success ¶
success(message, **kwargs)
Log success message with green color.
Source code in dnallm/utils/logger.py
89 90 91 | |
warning ¶
warning(message, **kwargs)
Log warning message.
Source code in dnallm/utils/logger.py
77 78 79 | |
warning_icon ¶
warning_icon(message, **kwargs)
Log warning message with yellow color and icon.
Source code in dnallm/utils/logger.py
101 102 103 | |
LoggingContext ¶
LoggingContext(level)
Context manager for temporary logging level changes.
Source code in dnallm/utils/logger.py
213 214 215 | |
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
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | |
log_debug ¶
log_debug(message)
Log debug message.
Source code in dnallm/utils/logger.py
189 190 191 | |
log_error ¶
log_error(message)
Log error message.
Source code in dnallm/utils/logger.py
179 180 181 | |
log_failure ¶
log_failure(message)
Log failure message.
Source code in dnallm/utils/logger.py
199 200 201 | |
log_function_call ¶
log_function_call(func)
Decorator to log function calls.
Source code in dnallm/utils/logger.py
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | |
log_info ¶
log_info(message)
Log info message.
Source code in dnallm/utils/logger.py
174 175 176 | |
log_progress ¶
log_progress(message)
Log progress message.
Source code in dnallm/utils/logger.py
204 205 206 | |
log_success ¶
log_success(message)
Log success message.
Source code in dnallm/utils/logger.py
194 195 196 | |
log_warning ¶
log_warning(message)
Log warning message.
Source code in dnallm/utils/logger.py
184 185 186 | |
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
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |