ats_utilities.logger.logger_bundle module¶
- Module
logger_bundle.py
- Copyright
Copyright (C) 2017 - 2026 Vladimir Roncevic <elektron.ronca@gmail.com> ats_utilities is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ats_utilities is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
- Info
Encapsulates logger runtime components for simplification of LoggerBundle creation.
- class ats_utilities.logger.logger_bundle.LoggerBundle(*, logger: Any, log_file: str, log_level: int)[source]¶
Bases:
objectEncapsulates logger runtime components for simplification of LoggerBundle creation.
It defines:
- attributes:
- logger - Logger instance.log_file - Log file path.log_level - Log level.
- methods:
- __post_init__ - Post-initialization hook to validate logger bundle.validate - Validates logger bundle.to_dict - Converts logger bundle instance to dictionary.
- log_file: str¶
- log_level: int¶
- logger: Any¶
- to_dict() dict[str, Any][source]¶
Converts logger bundle instance to dictionary.
- Returns:
Dictionary representation of the logger bundle instance.
- Return type:
<dict[str, Any]>
- Exceptions:
None.
- validate() None[source]¶
Validates logger bundle. Performs validation of all bundle attributes. All attributes must be non-None and instances of their respective interfaces.
- Exceptions:
- ATSValueError: Logger must be provided.ATSValueError: Log file must be provided.ATSValueError: Log level must be provided.ATSTypeError: Logger must be an ILogger or standard logging.Logger instance.ATSTypeError: Log file must be a str instance.ATSTypeError: Log level must be an int instance.