jyk logging utils package
Project description
jyk-logging
jyk logging utils
Installation
$ pip install jyk-logging
Getting Started
- Cases
import logging
from jyk.logging import initConsoleLogging, initLogging, LogRootPath, FormatterMode
# case 1: initConsoleLogging(level=logging.INFO, mode=FormatterMode.BRIEF)
initConsoleLogging()
# case 2: initLogging(name, level=logging.INFO, mode=FormatterMode.INTACT):
LogRootPath.set('var/log/jyk')
initLogging('test.log')
- API
def initConsoleLogging(level=logging.INFO, mode=FormatterMode.BRIEF):
"""Initializes logging only to console.
Args:
level: logging.level
"""
def initLogging(name, level=logging.INFO, mode=FormatterMode.INTACT):
"""Initializes logging.
Args:
level: logging.level
"""
class FormatterMode(object):
BRIEF = "brief"
INTACT = 'intact'
if mode == FormatterMode.INTACT:
formatter = logging.Formatter(
"%(asctime)s [%(name)s] %(levelname)s: %(message)s")
else:
formatter = logging.Formatter("[%(name)s]: %(message)s")
Running the tests
$ cd jyk-logging
$ pytest -s
Changelog
1.0.2
2020-04-22 release
BugFix
- fix encoding
1.0.1
2019-10-19 release
Features
- add initConsoleLogging
- add initLogging
- add LogRootPath
- add FormatterMode
TODOs
- add color api
Authors
- kongkong Jiang - Initial work - jyker
License
This project is licensed under the MIT License - see the LICENSE file for details
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
jyk-logging-1.0.2.tar.gz
(7.1 kB
view hashes)
Built Distribution
Close
Hashes for jyk_logging-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c07e6b770c3653d1cc71e880829392180fe82c22783ffe04b2bd956d0783d62b |
|
MD5 | ffdd08f47aafaec6fba655bcb548c68c |
|
BLAKE2b-256 | 42a405c0c84be3658268c0d1529696f4d9988e5381f0c28b65c3e5b99405490d |