https://github.com/obervinov/logger-package
This module is designed to quickly initialize and configure readable and structured logging for my python projects.
https://github.com/obervinov/logger-package
log logger logging logs module poetry poetry-python python-module python-modules python3
Last synced: about 7 hours ago
JSON representation
This module is designed to quickly initialize and configure readable and structured logging for my python projects.
- Host: GitHub
- URL: https://github.com/obervinov/logger-package
- Owner: obervinov
- License: mit
- Created: 2022-11-02T19:07:10.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-12-23T21:37:05.000Z (5 months ago)
- Last Synced: 2025-12-25T07:37:48.958Z (5 months ago)
- Topics: log, logger, logging, logs, module, poetry, poetry-python, python-module, python-modules, python3
- Language: Python
- Homepage:
- Size: 133 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README
# Logger Package
[](https://github.com/obervinov/logger-package/actions/workflows/release.yaml)
[](https://github.com/obervinov/logger-package/actions/workflows/github-code-scanning/codeql)
[](https://github.com/obervinov/logger-package/actions/workflows/pr.yaml)





##
About this project
This is an additional implementation over the **logging** module.
This module is designed for fast initialization and configuration of readable and structured logging.
##
Supported functions
- Color selection depending on the logging level
- Structured and formatted message for more informative
- Loading the logger configuration and format from a environment variables
##
Installing with Poetry
```bash
tee -a pyproject.toml < Usage example
### Environment variables
| Name | Description | Default value |
| ------------------------ | ------------------------------------------------ | --------------------------------------------------------------------- |
| `LOGGER_FORMAT` | A string with the event logging format | `[%(asctime)s] %(levelname)s [%(name)s.%(funcName)s:%(lineno)d] %(message)s` |
| `LOGGER_LEVEL` | Event logging level: DEBUG, INFO, WARNING, ERROR, CRITICAL or NOT SET | `INFO` |
| `LOGGER_DATE_FORMAT` | Date format in logging event output | `%d/%b/%Y %H:%M:%S` |
### Examples
#### Simple
```python
# Import module
from logger import log
# Examples
# error message
log.error(f"this error: {error}")
# warning message
log.warning(f"this warning: {warn}")
# info message
log.info(f"this info: {info}")
```
#### With using class
```python
# Import module
from logger import log
# Add logger to class
class myproject:
def __init__(self):
self.log = create_logger(__name__, self.__class__.__name__)
self.log.info("Init my class")
def warning(self):
self.log.warning("Warning")
def error(self):
self.log.error("Critical error")
def debug(self):
self.log.debug("Debug")
mp = myproject()
mp.warning()
mp.error()
mp.debug()
```

##
GitHub Actions
| Name | Version |
| ------------------------ | ----------- |
| GitHub Actions Templates | [v2.1.1](https://github.com/obervinov/_templates/tree/v2.1.1) |