https://github.com/jacebrowning/minilog
Minimalistic wrapper for Python logging.
https://github.com/jacebrowning/minilog
logging python
Last synced: about 1 year ago
JSON representation
Minimalistic wrapper for Python logging.
- Host: GitHub
- URL: https://github.com/jacebrowning/minilog
- Owner: jacebrowning
- License: mit
- Created: 2018-03-02T18:43:01.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2025-02-13T02:31:15.000Z (over 1 year ago)
- Last Synced: 2025-03-30T14:09:48.420Z (about 1 year ago)
- Topics: logging, python
- Language: Python
- Homepage: https://minilog.readthedocs.io
- Size: 717 KB
- Stars: 29
- Watchers: 2
- Forks: 4
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# minilog
A minimalistic logging wrapper for Python.
[](https://github.com/jacebrowning/minilog/actions)
[](https://ci.appveyor.com/project/jacebrowning/minilog)
[](https://codecov.io/gh/jacebrowning/minilog)
[](https://scrutinizer-ci.com/g/jacebrowning/minilog)
[](https://pypi.org/project/minilog)
[](https://pypi.org/project/minilog)
[](https://pypistats.org/packages/minilog)
## Usage
Every project should utilize logging, but for simple use cases, this requires a bit too much boilerplate. Instead of including all of this in your modules:
```python
import logging
log = logging.getLogger(__name__)
def greet(name):
log.info("Hello, %s!", name)
if __name__ == "__main__":
logging.basicConfig(
level=logging.INFO,
format="%(levelname)s: %(name)s: %(message)s",
)
```
with this package you can simply:
```python
import log
def greet(name):
log.info("Hello, %s!", name)
if __name__ == "__main__":
log.init()
```
It will produce the exact same standard library `logging` records behind the scenes with automatic formatting for non-strings.
## Installation
Install this library directly into an activated virtual environment:
```text
$ pip install minilog
```
or add it to your [Poetry](https://poetry.eustace.io/) project:
```text
$ poetry add minilog
```
## Documentation
To view additional options, please consult the [full documentation](https://minilog.readthedocs.io/en/latest/logging/).