Skip to main content

jyk logging utils package

Project description

jyk-logging

jyk logging utils

Installation

$ pip install jyk-logging

Getting Started

  1. 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')
  1. 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


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.3.linux-x86_64.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jyk_logging-1.0.3-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file jyk-logging-1.0.3.linux-x86_64.tar.gz.

File metadata

  • Download URL: jyk-logging-1.0.3.linux-x86_64.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for jyk-logging-1.0.3.linux-x86_64.tar.gz
Algorithm Hash digest
SHA256 48fbf0771b212b85554a62dc22fd99b99cadfa8ca81e5e9a480016316ada7825
MD5 ce2ddea06e273ee2f1459db391366f38
BLAKE2b-256 02f5ecc27911fcdcd1d9d06653d6c473a5e852df7a65fb7d1e2768a452bdb984

See more details on using hashes here.

File details

Details for the file jyk_logging-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: jyk_logging-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for jyk_logging-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e9747acb8ce5bbbeffd99230a932776bdc943953b3b2f71e1e28bcad16ffd40a
MD5 a06cb713d4932737d1d9cdb33f60efc9
BLAKE2b-256 135ba5bc1ba030e7313f412ce8da0c0ef812973e04a74c4b74fb07d4536414e9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page