This is my custom logger
Project description
DM-Logger
Urls
Initial parameters
name: str # logger name (*required)
logging_level: str = "DEBUG", # min logging level
logs_dir_path: str = "logs", # log parent directories, leave blank to not write
print_logs: bool = True, # print to the console or not
file_name: str = "", # log file name, default = <name>.log
write_mode: Literal["a", "w"] = "w", # start with new file or continue old one
max_MB: int = 5, # max log file size (MB)
max_count: int = 10, # max count of saved logs
format_string: str = "%(asctime)s.%(msecs)03d [%(levelname)s] (%(module)s.%(funcName)s:%(lineno)d) %(message)s",
Example
from dm_logger import DMLogger
dm_logger = DMLogger("main")
dm_logger.info("test message", tag="test tag")
dm_logger.debug("new message", id=123312)
dm_logger.info("only mess")
dm_logger.critical(env="production")
dm_logger.warning({"key": "value"})
dm_logger.error(["item1", "item2", 3])
dm_logger.info()
Requirements
Python 3.7 or higher.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dm-logger-0.2.4.tar.gz
(2.9 kB
view hashes)
Built Distribution
Close
Hashes for dm_logger-0.2.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe53d5c74e9483c0560cf316f729d83dfd1c8b794825f3e45ed367621402684d |
|
MD5 | 2d5435c8bf6e16aaa3083d2c1cf2e283 |
|
BLAKE2b-256 | 188f1091ff43e045a6bb2bd59ca3fd7c3684c9a250d455ca0c5d4c4c35fdd7e8 |