This a custom `logging` for `Loki`
Project description
Lokilogger
Introduction
This package is just a wrapper around logging and colorlog.
Installation
pip install lokilogger
Usage
At the start of your program
from lokilogger.logging import set_log_mode
import logging
env = os.getenv("LOGMODE", "DEV")
set_log_mode("env") # A global setting here, you can set it to `PROD`, `DEV`or `DEV_NO_COLOR`
Use it in other modules
logger = logging.getLogger(__name__)
logger.error('error message')
Output
env=Prod
"time": "2022-01-15 07:56:05,440, ""severity": "INFO", "logger": "root","module": "logging", "message": "Dev env is set to production"
"time": "2022-01-15 07:56:05,440, ""severity": "ERROR", "logger": "__main__","module": "test", "message": "error message"
"time": "2022-01-15 07:56:05,440, ""severity": "INFO", "logger": "root","module": "test", "message": "error message"
env=DEV_NO_COLOR
2022-01-15 07:54:40,039 | INFO | root | Dev env is set to development without colorlog
2022-01-15 07:54:40,039 | ERROR | __main__ | error message
2022-01-15 07:54:40,039 | INFO | root | error message
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
lokilogger-1.0.2.tar.gz
(2.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lokilogger-1.0.2.tar.gz.
File metadata
- Download URL: lokilogger-1.0.2.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
234ad8c78a9b24e885bf1ba648297a50278cd2d2207cc90d17e618772f54f166
|
|
| MD5 |
1735118998f8b750f4b918d53d3f998c
|
|
| BLAKE2b-256 |
69ca39f19bdba8bd8ef8905e3f64303c8cb9d154d5e68988906c1a2a4a0f0608
|
File details
Details for the file lokilogger-1.0.2-py3-none-any.whl.
File metadata
- Download URL: lokilogger-1.0.2-py3-none-any.whl
- Upload date:
- Size: 2.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6fd81d984e043ef3b1c95480aa7122f1d0c62ee2b8968351b012cc6914517737
|
|
| MD5 |
c8f459753b27125c5899cf5df1398d79
|
|
| BLAKE2b-256 |
242c1e48ce38567fe3e1f5ff027db77f696b9fc6deae12483d11d8535e49c19e
|