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.1.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.1.tar.gz.
File metadata
- Download URL: lokilogger-1.0.1.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 |
0b4325306ae4b293f0afaa309c706d74bc04e4be5a77a467adee722cdf82ed3d
|
|
| MD5 |
6d9ac7fe25441c798f4db076040b4113
|
|
| BLAKE2b-256 |
c5b53696d9387c16f332cfc2180c5eb7aba6d1942d3ed3eb600cfe9277552eef
|
File details
Details for the file lokilogger-1.0.1-py3-none-any.whl.
File metadata
- Download URL: lokilogger-1.0.1-py3-none-any.whl
- Upload date:
- Size: 2.7 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 |
0e4e81e9249a213f836e4bd2353d4d49bc0b908ab7fc9508c246d6d0f94f0aa1
|
|
| MD5 |
66ff8aadc8aa2814e0025adaad50393a
|
|
| BLAKE2b-256 |
37afeda66ac1f0293223d874abb778c223eb8fc5450a32960246f0f9d11e16a9
|