Log information: Print the log, export the log file.
Project description
ykenan_log
Print and save a simple log to a file
This is a simple log package. You can see Github-ykenan_log PyPI-ykenan_log
upload
py -m build
twine check dist/*
twine upload dist/*
Use
install
pip install ykenan_log
use
# -*- coding: utf-8 -*-
from ykenan_log import Logger
log = Logger("name", "log")
if __name__ == '__main__':
print("run...")
log.debug("info......")
log.info("info......")
log.warn("info......")
log.error("info......")
output
2023-03-17 09:21:36 root name[34768] DEBUG info......
2023-03-17 09:21:36 root name[34768] INFO info......
2023-03-17 09:21:36 root name[34768] WARNING info......
2023-03-17 09:21:36 root name[34768] ERROR info......
Introduction
main function
ykenan_log.
Logger
(name: str = None,
log_path: str = None,
level: str = "INFO",
is_solitary: bool = True,
is_form_file: bool = True,
size: int = 104857600,
backup_count: int = 10,
encoding: str = "UTF-8"
)
:param name: Project Name
:param log_path: Log file output path. Default is log_%Y%m%d.log.
:param level: Log printing level. Default is INFO.
:param is_solitary: When the file path is consistent (here, the log_path parameter is not a specific file name, but a file path), whether the file is formed independently according to the name parameter. Default is True.
:param is_form_file: Whether to form a log file. Default is True.
:param size: Setting the file size if a file is formed. Default is 104857600. (100MB)
:param backup_count: Setting the number of rotating files if a file is formed. Default is 10.
:param encoding: Setting of file encoding if a file is formed. Default is UTF-8.
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
ykenan_log-0.2.1.tar.gz
(4.7 kB
view hashes)
Built Distribution
Close
Hashes for ykenan_log-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aeb3bbbc3a1716fd0f6ed440ca1b3b644f52964e2d5915273e275c452900cbef |
|
MD5 | 24c612e642b1d418bb48e3bb076edc3a |
|
BLAKE2b-256 | 4fed33f10b5b3597a969843034acb1a6eb81da0d8502a781786108392414ab8b |