1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from mozlog.proxy import ProxyLogger
class RaptorLogger:
app = ""
def __init__(self, component=None):
self.logger = ProxyLogger(component)
def set_app(self, app_name):
"""Sets the app name to prefix messages with."""
RaptorLogger.app = " [" + app_name + "]"
def exception(self, message, **kwargs):
self.critical(message, **kwargs)
def debug(self, message, **kwargs):
return self.logger.debug("Debug: {}".format(message), **kwargs)
def info(self, message, **kwargs):
return self.logger.info("Info: {}".format(message), **kwargs)
def warning(self, message, **kwargs):
return self.logger.warning(
"Warning:{} {}".format(RaptorLogger.app, message), **kwargs
)
def error(self, message, **kwargs):
return self.logger.error(
"Error:{} {}".format(RaptorLogger.app, message), **kwargs
)
def critical(self, message, **kwargs):
return self.logger.critical(
"Critical:{} {}".format(RaptorLogger.app, message), **kwargs
)
def log_raw(self, message, **kwargs):
return self.logger.log_raw(message, **kwargs)
def process_output(self, *args, **kwargs):
return self.logger.process_output(*args, **kwargs)
def crash(self, *args, **kwargs):
return self.logger.crash(*args, **kwargs)
|