-
Notifications
You must be signed in to change notification settings - Fork 86
/
logging_methods.py
executable file
·41 lines (31 loc) · 1.22 KB
/
logging_methods.py
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
from typing import Optional, List, Dict, Union
import xml.etree.ElementTree as ET
from .logger import Logger
class LoggingMethods:
# Logging Methods
def enable_logging(self, logger_obj: Logger):
self.logger = logger_obj
def log(self, l: str):
if self.logger is not None:
self.logger.log(l)
def log_debug(self, l: str):
if self.logger is not None:
self.logger.log_debug(l)
def start_log_block(self):
if self.logger is not None:
self.logger.start_log_block()
def end_log_block(self):
if self.logger is not None:
self.logger.end_log_block()
def log_uri(self, uri: str, verb: str):
if self.logger is not None:
self.logger.log_uri(uri=uri, verb=verb)
def log_xml_request(self, xml: ET.Element, verb: str, uri: str):
if self.logger is not None:
self.logger.log_xml_request(xml=xml, verb=verb, uri=uri)
def log_xml_response(self, xml: Union[str, ET.Element]):
if self.logger is not None:
self.logger.log_xml_response(xml=xml)
def log_error(self, error_text: str):
if self.logger is not None:
self.logger.log_error(error_text=error_text)