Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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: 3 days ago
JSON representation

Fancy defaults for the awesome loguru logs!

Awesome Lists containing this project

README

        


Skeptycal logo

# 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._

> [![macOS Version](https://img.shields.io/badge/macOS-10.16%20Big%20Sur-orange?logo=apple)](https://www.apple.com) [![GitHub Pipenv locked Python version](https://img.shields.io/badge/Python-3.8-yellow?color=3776AB&logo=python&logoColor=yellow)](https://www.python.org/)

> _Copyright (c) 2018 [Michael Treanor][2]_

> [![Twitter Follow](https://img.shields.io/twitter/follow/skeptycal.svg?style=social)][link_twitter] [![GitHub followers](https://img.shields.io/github/followers/skeptycal.svg?label=GitHub&style=social)][link_github]

> _AutoSys is licensed under the [MIT License][3]_

> [![License](https://img.shields.io/badge/License-MIT-darkblue)](https://skeptycal.mit-license.org/1976/)

## Contributions Welcome!

[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v1.4%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?logo=prettier)](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 logo





Pypi version
Python versions
Documentation
Build status
Coverage
Code quality
License




Loguru logo

---

**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)