https://github.com/cyanchanges/logurueverywhere
Replace loguru everywhere
https://github.com/cyanchanges/logurueverywhere
Last synced: 6 months ago
JSON representation
Replace loguru everywhere
- Host: GitHub
- URL: https://github.com/cyanchanges/logurueverywhere
- Owner: CyanChanges
- Created: 2023-05-02T05:49:17.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2023-12-28T05:51:08.000Z (over 2 years ago)
- Last Synced: 2025-05-09T00:16:46.799Z (about 1 year ago)
- Language: Python
- Size: 36.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Loguru Ever
[](https://pypi.org/project/EverLoguru/)
[](https://github.com/Chinese-Cyq20100313/loguruEverywhere/releases)
Use and replace logging to loguru everywhere!
_**Loguru used all over the world. | 全世界都在用 Loguru**_
## Installation
You can install Loguru Ever from PyPI:
```shell
pip install EverLoguru
```
## Usage
EverLoguru is a simple package that replaces the standard logging module with loguru. Loguru is a modern and easy-to-use logging library for Python. With Loguru Ever, you can use loguru to log in any module that uses logging, without changing any code.
To use EverLoguru, you just need to import it and call the `install_class` function at the beginning of your program. This will replace the logging module in the sys.modules dictionary with loguru. After that, you can use loguru as usual.
For example, if you have a module called `foo.py` that uses logging:
```python
import logging
logger = logging.getLogger(__name__)
def bar():
logger.info("Hello from bar")
```
You can use EverLoguru in your main script like this:
```python
import ever_loguru
ever_loguru.install_class()
import foo
foo.bar()
```
This will output:
```log
2021-12-15 16:13:49.123 | INFO | foo:bar:5 - Hello from bar
```