Skip to main content

logging-mv-integrations

Extension to Python logging functionality intended for TUNE Multiverse Integrations.

Badges

docs

Documentation Status License Status

info

Hit Count Contributors

tests

Travis-CI Build Status Code Coverage Status

package

PyPI Package latest release Supported versions

other

Requirements Status

Install

pip install logging_mv_integrations

Architecture

logging-mv-integrations is an extension of the logging facility for Python used for TUNE Multiverse Integrations providing custom logger levels, format, and output.

UML logging-mv-integrations

Function: get_logger()

def get_logger(
    logger_name,
    logger_version=None,
    logger_level=logging.INFO,
    logger_format=LoggingFormat.JSON,
    logger_output=LoggingOutput.STDOUT_COLOR,
    logger_handler=None
):

get_logger(): Parameters

Parameter

Purpose

logger_name

Return a logger with the specified name or, if name is None, return a logger which is the root logger of the hierarchy.

logger_version

logger_format

LoggingFormat

logger_output

LoggingOutput

logger_handler

logging.StreamHandler() or logging.FileHandler()

Logging Levels

Same Python logging levels, including one additional level NOTE.

Level

Purpose

DEBUG

Detailed information, typically of interest only when diagnosing problems.

NOTE

Detailed information, request processing, for example, request using cURL.

INFO

Confirmation that things are working as expected. [DEFAULT]

WARNING

An indication that something unexpected happened, or indicative of some problem in the near future. The software is still working as expected.

ERROR

Due to a more serious problem, the software has not been able to perform some function.

CRITICAL

A serious error, indicating that the program itself may be unable to continue running.

Logging Format

Format

Purpose

STANDARD

Standard logging format.

JSON

JSON logging format. [DEFAULT]

class LoggingFormat(object):
    """TUNE Logging Format ENUM
    """
    STANDARD = "standard"
    JSON = "json"

Logging Output

Output

Purpose

STDOUT

Standard Output to terminal

STDOUT_COLOR

Standard Output using colored terminal

FILE

Standard Output to file created within ./tmp/log_<epoch time seconds>.json.

class LoggingOutput(object):
    """TUNE Logging Output ENUM
    """
    STDOUT = "stdout"
    STDOUT_COLOR = "color"
    FILE = "file"

Logging JSON Format

import logging
from logging_mv_integrations import (LoggingFormat, get_logger, __version__)

log = get_logger(
    logger_name=__name__,
    logger_version=__version__,
    logger_format=LoggingFormat.JSON,
    logger_level=logging.NOTE
)

log.info("logging: info", extra={'test': __name__})
log.note("logging: note", extra={'test': __name__})
log.debug("logging: debug", extra={'test': __name__})
log.warning("logging: warning", extra={'test': __name__})
log.error("logging: error", extra={'test': __name__})
log.critical("logging: critical", extra={'test': __name__})
log.exception("logging: exception", extra={'test': __name__})

Logging JSON Example Output

$ python3 examples/example_logging_json.py

{"asctime": "2017-10-20 08:31:14 -0700", "levelname": "INFO", "name": "__main__",
"version": "0.1.6", "message": "logging: info", "test": "__main__"}
{"asctime": "2017-10-20 08:31:14 -0700", "levelname": "NOTE", "name": "__main__",
"version": "0.1.6", "message": "logging: note", "test": "__main__"}
{"asctime": "2017-10-20 08:31:14 -0700", "levelname": "WARNING", "name": "__main__",
"version": "0.1.6", "message": "logging: warning", "test": "__main__"}
{"asctime": "2017-10-20 08:31:14 -0700", "levelname": "ERROR", "name": "__main__",
"version": "0.1.6", "message": "logging: error", "test": "__main__"}
{"asctime": "2017-10-20 08:31:14 -0700", "levelname": "CRITICAL", "name": "__main__",
"version": "0.1.6", "message": "logging: critical", "test": "__main__"}
{"asctime": "2017-10-20 08:31:14 -0700", "levelname": "ERROR", "name": "__main__",
"version": "0.1.6", "message": "logging: exception", "exc_info": "NoneType: None",
"test": "__main__"}

Requirements

logging-mv-integrations module is built upon Python 3 and has dependencies upon several Python modules available within Python Package Index PyPI.

make install-requirements

or

python3 -m pip uninstall --yes --no-input -r requirements.txt
python3 -m pip install --upgrade -r requirements.txt

Dependencies

Release History

0.5.4 (2018-02-16)

  • migrate to github/TuneLab

0.5.3 (2018-01-25)

  • migrate to github/tuneinc

0.5.2 (2017-12-10)

  • readthedocs.org

0.4.0 (2017-11-24)

  • README

0.3.2 (2017-11-21)

  • README

  • Travis CI

0.1.7 (2017-10-26)

  • Using Formatted String Literals

0.1.6 (2017-10-19)

  • Logging Output: FILE, STDOUT, STDOUT_COLOR

0.1.5 (2017-10-17)

  • Fix standard format

0.1.4 (2017-10-09)

  • Multiple handlers fix

0.1.3 (2017-09-12)

  • Use python standard logging instead of tune_logging and remove all unneeded files

0.1.2 (2017-02-03)

  • Switch to using casting from safe-cast package

0.1.1 (2017-02-03)

  • Python 3.6 Upgrade

0.0.1 (2016-11-19)

  • First Commit

Release files for logging-mv-integrations 0.5.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for logging-mv-integrations 0.5.4
File Size Uploaded
logging-mv-integrations-0.5.4.tar.gz 33.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for logging-mv-integrations 0.5.4
File Interpreter ABI Platform
logging_mv_integrations-0.5.4-py3-none-any.whl Python 3 none any Details

Total release size: 51.3 kB

Release files / logging-mv-integrations-0.5.4.tar.gz

Download URL logging-mv-integrations-0.5.4.tar.gz
Size 33.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1abb0fddc9121fc4190907df74e91dc605fca04378fd70a9600fc31d520b9c5c
BLAKE2b-256 checksum
How to use checksums
e16905dd94a8a3937f52dea5ca2f92eaa7ef8e6fc9664551519498157a7cb195
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / logging_mv_integrations-0.5.4-py3-none-any.whl

Download URL logging_mv_integrations-0.5.4-py3-none-any.whl
Size 17.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c442ba7416bc916458d349e7c39ac917f09f2deb46a102ab903f302a708f182c
BLAKE2b-256 checksum
How to use checksums
d0b8c33143766265256d97cf35301afcdaea2a250225294411f7919c3a16808e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.5.4 This release

2 release files

0.5.3

2 release files

0.5.2

3 release files

0.5.1

3 release files

0.5.0

3 release files

0.2.1

3 release files

0.2.0

3 release files

0.1.9

3 release files

0.1.8

3 release files

0.1.6

3 release files

0.1.5

3 release files

0.1.4

3 release files

0.1.3

3 release files

0.1.2

3 release files

0.1.1

3 release files

0.1.0

3 release files

0.0.4

4 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page