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.3
2021-04-19 release
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
Built Distribution
Close
Hashes for jyk-logging-1.0.3.linux-x86_64.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48fbf0771b212b85554a62dc22fd99b99cadfa8ca81e5e9a480016316ada7825 |
|
MD5 | ce2ddea06e273ee2f1459db391366f38 |
|
BLAKE2b-256 | 02f5ecc27911fcdcd1d9d06653d6c473a5e852df7a65fb7d1e2768a452bdb984 |
Close
Hashes for jyk_logging-1.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9747acb8ce5bbbeffd99230a932776bdc943953b3b2f71e1e28bcad16ffd40a |
|
MD5 | a06cb713d4932737d1d9cdb33f60efc9 |
|
BLAKE2b-256 | 135ba5bc1ba030e7313f412ce8da0c0ef812973e04a74c4b74fb07d4536414e9 |