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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

Supported by

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