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
Release files for jyk-logging 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| jyk-logging-1.0.3.linux-x86_64.tar.gz | 14.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jyk_logging-1.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.9 kB
Release files / jyk-logging-1.0.3.linux-x86_64.tar.gz
| Download URL | jyk-logging-1.0.3.linux-x86_64.tar.gz |
|---|---|
| Size | 14.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
48fbf0771b212b85554a62dc22fd99b99cadfa8ca81e5e9a480016316ada7825
|
|
BLAKE2b-256 checksum How to use checksums |
02f5ecc27911fcdcd1d9d06653d6c473a5e852df7a65fb7d1e2768a452bdb984
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.8
|
Release files / jyk_logging-1.0.3-py3-none-any.whl
| Download URL | jyk_logging-1.0.3-py3-none-any.whl |
|---|---|
| Size | 9.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e9747acb8ce5bbbeffd99230a932776bdc943953b3b2f71e1e28bcad16ffd40a
|
|
BLAKE2b-256 checksum How to use checksums |
135ba5bc1ba030e7313f412ce8da0c0ef812973e04a74c4b74fb07d4536414e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.8
|