utils.loggy

loggy

Common code to force logging to the console for pipelines

Example Usage: from utils import loggy

 1#!/usr/bin/env python3
 2"""
 3loggy
 4
 5Common code to force logging to the console for pipelines
 6
 7Example Usage:
 8    from utils import loggy
 9"""
10import logging
11import sys
12
13logging.basicConfig(
14    stream=sys.stdout,
15    format="%(levelname)s %(asctime)s - %(message)s",
16    level=logging.INFO
17)
18loggy = logging.getLogger()
19loggy.info("loggy Initialized")
20
21
22def debug(msg):
23    """
24    debug()
25
26    Log a DEBUG message to stdout
27    """
28    loggy.debug(msg)
29
30
31def info(msg):
32    """
33    info()
34
35    Log an INFO message to stdout
36    """
37    loggy.info(msg)
38
39
40def warn(msg):
41    """
42    warn()
43
44    Log a WARNING message to stdout
45    """
46    loggy.warning(msg)
47
48
49def warning(msg):
50    """
51    warning()
52
53    Log a WARNING message to stdout
54    """
55    loggy.warning(msg)
56
57
58def error(msg):
59    """
60    error()
61
62    Log an ERROR message to stdout
63    """
64    loggy.error(msg)
def debug(msg)
23def debug(msg):
24    """
25    debug()
26
27    Log a DEBUG message to stdout
28    """
29    loggy.debug(msg)

debug()

Log a DEBUG message to stdout

def info(msg)
32def info(msg):
33    """
34    info()
35
36    Log an INFO message to stdout
37    """
38    loggy.info(msg)

info()

Log an INFO message to stdout

def warn(msg)
41def warn(msg):
42    """
43    warn()
44
45    Log a WARNING message to stdout
46    """
47    loggy.warning(msg)

warn()

Log a WARNING message to stdout

def warning(msg)
50def warning(msg):
51    """
52    warning()
53
54    Log a WARNING message to stdout
55    """
56    loggy.warning(msg)

warning()

Log a WARNING message to stdout

def error(msg)
59def error(msg):
60    """
61    error()
62
63    Log an ERROR message to stdout
64    """
65    loggy.error(msg)

error()

Log an ERROR message to stdout