https://github.com/skeptycal/auto_loguru
Fancy defaults for the awesome loguru logs!
https://github.com/skeptycal/auto_loguru
log logger logging loguru python
Last synced: 4 months ago
JSON representation
Fancy defaults for the awesome loguru logs!
- Host: GitHub
- URL: https://github.com/skeptycal/auto_loguru
- Owner: skeptycal
- License: mit
- Created: 2020-07-23T21:05:33.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-08-27T01:18:33.000Z (almost 5 years ago)
- Last Synced: 2025-02-18T19:21:32.876Z (5 months ago)
- Topics: log, logger, logging, loguru, python
- Language: Python
- Homepage: http://skeptycal.github.com/auto_loguru
- Size: 449 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
![]()
# AutoSysLoguru
### Fancy defaults for the awesome [Loguru][loguru] logger by [Delgan][delgan]!
## Install:
```sh
pip install autosysloguru
```## Usage
The simplest thing ever invented for logging:
```py
from autosysloguru import logger
logger.info('This is a message!')
```## _That's it! Nothing else! It just works._
---
## Options:
If you want any of these defaults, you only have to set it up once. Config files can easily be copied and pasted.
- ### Set environment variables (e.g. in .bashprofile, .profile, or .zshrc):
```sh
LOGURU_LEVEL=TRACE
LOGURU_CONFIG_FILENAME=~/path/to/some_file.py
```- ### Use a configuration section in pyproject.toml
```toml
[autosysloguru]
dev_level = "DEBUG"
dev_handlers = [
{ sink = "sys.stdout", colorize = "True", format = "{time} {message}" },
{ sink = "output.json", serialize = "True" },
# Set 'False' to not leak sensitive data in production
{ sink = "output.log", backtrace = "True", diagnose = "True", rotation = "500 MB" }
]
prod_level = "SUCCESS"
prod_handlers = [
{ sink = "sys.stdout", colorize = "True", format = "{time} {message}" },
{ sink = "output.log", rotation = "500 MB", retention = "10 days" }
]
```- ### Use a custom python configuration script
```py
dev_level: str = 'DEBUG'
prod_level: str = 'SUCCESS'dev_handlers: List = [
{"sink": sys.stdout, "colorize": True, "format": "{time} {message}"},
{"sink": "output.json", "serialize": True},
# Set 'False' to not leak sensitive data in prod
{"sink": "output.log", "backtrace": True, "diagnose": True, "rotation": "500 MB"}
]prod_handlers: List = [
{"sink": sys.stdout, "colorize": True, "format": "{time} {message}"},
{"sink": "output.log", "rotation": "500 MB", "retention": "10 days"}
]# load the configuration from AutoSysLoguru
logger.config()
```---
> ## Part of the [AutoSys][1] package
> _System utilities for Python on macOS._
> [](https://www.apple.com) [](https://www.python.org/)
> _Copyright (c) 2018 [Michael Treanor][2]_
> [][link_twitter] [][link_github]
> _AutoSys is licensed under the [MIT License][3]_
> [](https://skeptycal.mit-license.org/1976/)
## Contributions Welcome!
[](CODE_OF_CONDUCT.md) [](https://github.com/prettier/prettier)
**Please feel free to offer suggestions and changes** (contribution instructions below). I have been coding for many years, but mostly as a side activity ... as a tool to assist me in other endeavors ... so I have not had the 'hard time' invested of constant coding that many of you have.
> Below is information from the original project repo.
---
---
**Loguru** is a library which aims to bring enjoyable logging in Python.
Did you ever feel lazy about configuring a logger and used `print()`
instead?... I did, yet logging is fundamental to every application and
eases the process of debugging. Using **Loguru** you have no excuse not
to use logging from the start.Also, this library is intended to make Python logging less painful by
adding a bunch of useful functionalities that solve caveats of the
standard loggers. Using logs in your application should be an
automatism, **Loguru** tries to make it both pleasant and powerful.# Features
- [Entirely ready out of the box without boilerplate][ready]
- [No Handler, no Formatter, no Filter: one function to rule them all][ready]
- [Easier file logging with rotation / retention / compression][ready]
- [Modern string formatting using braces style][ready]
- [Exceptions catching within threads or main][ready]
- [Pretty logging with colors][ready]
- [Asynchronous, Thread-safe, Multiprocess-safe][ready]
- [Fully descriptive exceptions][ready]
- [Structured logging as needed][ready]
- [Lazy evaluation of expensive functions][ready]
- [Customizable levels][ready]
- [Better datetime handling][ready]
- [Suitable for scripts and libraries][ready]
- [Entirely compatible with standard logging][ready][ready]: ()
[delgan]: (https://github.com/Delgan)
[loguru]: (https://loguru.readthedocs.io/en/stable/overview.html)
[1]: https://www.github.com/skeptycal/autosys
[2]: https://www.twitter.com/skeptycal
[3]: https://opensource.org/licenses/MIT
[link_netlify]: (https://app.netlify.com/sites/mystifying-keller-ab5658/deploys)
[link_travis]: (https://travis-ci.com/skeptycal/autosys)
[link_twitter]: (https://www.twitter.com/skeptycal)
[link_github]: (https://www.github.com/skeptycal)