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 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.3.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

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

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: lokilogger-1.0.3.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

File hashes

Hashes for lokilogger-1.0.3.tar.gz
Algorithm Hash digest
SHA256 4ed8fdad1ff87a12aaa6cd7c951f6dd3b1df8e48114c637ce27ecd67f7a3329e
MD5 aefbea57bb64d9018dd333c8e80c7e75
BLAKE2b-256 fd04bcc463b49914e5f299adca4b8f2a1bac7a940305ea65e18e2e1102ed2fbd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lokilogger-1.0.3-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.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

File hashes

Hashes for lokilogger-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 75b24864aaac1652b00e756edaaa8dc68b9a5fc20bc66b034149409bd755cacb
MD5 db04434ec15afcdd0e80c2144b82e774
BLAKE2b-256 957e06c9491ced2b403db0a57ab54645d4894ee118c44b1dc3c83967bee949b2

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