Custom logging package for MEH projects.
Project description
meh-logging-python
Before you start
To use the logging module in Python, you will need to have a Manifest file called
package.json
in the project's root folder. The file should follow the file structure guidelines provided at https://docs.npmjs.com/cli/v9/configuring-npm/package-json.
Prerequisite software
The software listed below is required beforehand.
Enum | Value |
---|---|
python | >= 3.10 |
pip | >= 22.2 |
Installation
To install the module from your terminal, simply execute the following command:
$ pip install meh_logging
Usage
The logging module searches for an OS environment variable called PYTHON_ENV
or ENV
. If the variable is set to "production", the module will use the log level INFO
; otherwise, it will use DEBUG
.
from meh_logging import logger, Levels
# Log some info
logger.info("hello world")
logger.debug("hello world")
logger.error("hello world")
# Log exception
try:
1 / 0
except Exception as e:
logger.info(e)
# Change log-level dynamically
logger.set_level(Levels().CRITICAL.value)
Levels
These are the log levels utilized by the module.
Enum | Value |
---|---|
NOT_SET | 0 |
DEBUG | 10 |
INFO | 20 |
WARNING / WARN | 30 |
ERROR | 40 |
CRITICAL | 50 |
Author(s)
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
Built Distribution
Hashes for meh_logging-1.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 892af71e128757350ba56c30e767d9be79c75e1167ec470ff9851aaac1c52724 |
|
MD5 | c9815f2c71e2b3b32a8b47739c08501e |
|
BLAKE2b-256 | 2f05d530a2ff1d0f27a8ddc9a0b06c7b43a3330caa58ef23195aa417391f0e9a |