Skip to main content

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 setLogMode
import logging
env = os.getenv("LOGMODE", "DEV")
setLogMode("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.0.tar.gz (2.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

lokilogger-1.0.0-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

lokilogger-1.0.0-1-py3-none-any.whl (2.7 kB view details)

Uploaded Python 3

File details

Details for the file lokilogger-1.0.0.tar.gz.

File metadata

  • Download URL: lokilogger-1.0.0.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

Hashes for lokilogger-1.0.0.tar.gz
Algorithm Hash digest
SHA256 bb45a2652b407a3d3da7f66f71328b7c96f8a06e7f12d50ef8315509a4f60351
MD5 1d682d1e09604fa553d16609c719e3c8
BLAKE2b-256 04c19d3317fe76b37fa341702121c8a2b8f7589ade6b6d84c7e632438dec4113

See more details on using hashes here.

File details

Details for the file lokilogger-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: lokilogger-1.0.0-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

Hashes for lokilogger-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 33b1b774ccafed4ae76bc3f90fe8adb4401b17f308a9c43fb33b70790bdf39dd
MD5 4e034f72ad57159b9fb518cc8a000086
BLAKE2b-256 0cc2cd250c4417ba0ae01dd5d48e578bb2853d0b8ecad6c2368cf3f8d5323613

See more details on using hashes here.

File details

Details for the file lokilogger-1.0.0-1-py3-none-any.whl.

File metadata

  • Download URL: lokilogger-1.0.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

Hashes for lokilogger-1.0.0-1-py3-none-any.whl
Algorithm Hash digest
SHA256 51f2d9023ed40463ea92ba05b3b336c3fff13d48d4e1b8c028e04b0975ffb4fd
MD5 6753613e80940efc9639ecb6fc8fd713
BLAKE2b-256 a0b0d79c0abf81c0b88640c0be257662137e823db810ed4c061ce94ed4ab0581

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page