1
|
|
|
"""Replicates some of the `logging.Logger` API.""" |
2
|
|
|
|
3
|
|
|
import sys |
4
|
|
|
import logging |
5
|
|
|
|
6
|
|
|
from . import utils |
7
|
|
|
|
8
|
|
|
|
9
|
|
|
def log(level, message, *args, **kwargs): |
10
|
|
|
utils.create_logger_record(level, message, *args, **kwargs) |
11
|
|
|
|
12
|
|
|
|
13
|
|
|
def debug(message, *args, **kwargs): |
14
|
|
|
log(logging.DEBUG, message, *args, **kwargs) |
15
|
|
|
|
16
|
|
|
|
17
|
|
|
def info(message, *args, **kwargs): |
18
|
|
|
log(logging.INFO, message, *args, **kwargs) |
19
|
|
|
|
20
|
|
|
|
21
|
|
|
def warning(message, *args, **kwargs): |
22
|
|
|
log(logging.WARNING, message, *args, **kwargs) |
23
|
|
|
|
24
|
|
|
|
25
|
|
|
def error(message, *args, **kwargs): |
26
|
|
|
log(logging.ERROR, message, *args, **kwargs) |
27
|
|
|
|
28
|
|
|
|
29
|
|
|
def critical(message, *args, **kwargs): |
30
|
|
|
log(logging.CRITICAL, message, *args, **kwargs) |
31
|
|
|
|
32
|
|
|
|
33
|
|
|
def exception(message, *args, **kwargs): |
34
|
|
|
kwargs['exc_info'] = kwargs.get('exc_info', sys.exc_info()) |
35
|
|
|
log(logging.ERROR, message, *args, **kwargs) |
36
|
|
|
|