Design Pattern Examples
Overview of object-oriented design patterns
bridge_consolelogger.py
Go to the documentation of this file.
5
6from .bridge_loggerinterface import ILogger
7from .bridge_loggerhelpers import LoggerHelpers
8
9
10
12
13
19 def _WriteLine(self, logLevel : str, msg : str) -> None:
20 formattedLine = LoggerHelpers.FormatLogLine(logLevel, msg)
21 print(formattedLine)
22
23 #-------------------------------------------------------------------------
24 # ILogger interface implementation
25 #-------------------------------------------------------------------------
26
27
30 def Close(self) -> None:
31 pass
32
33
37 def LogTrace(self, msg : str) -> None:
38 self._WriteLine("TRACE", msg)
39
40
44 def LogInfo(self, msg : str) -> None:
45 self._WriteLine("INFO", msg)
46
47
51 def LogError(self, msg : str) -> None:
52 self._WriteLine("ERROR", msg)
53
54
55 #--------------------------------------------------------------------------
56 # Class factory static method
57 #--------------------------------------------------------------------------
58
59
64 @staticmethod
65 def CreateLogger() -> ILogger:
66 return ConsoleLogger()
@ Close
Window is asked to close itself, generally sent by the window itself in response to a button up in a ...
Represents a logger that writes logging to the standard output.
None LogError(self, str msg)
Log error messages to the configured output.
None LogTrace(self, str msg)
Log trace messages to the configured output.
ILogger CreateLogger()
Create an instance of a console logger, which writes to the standard output.
None LogInfo(self, str msg)
Log informational messages to the configured output.
None _WriteLine(self, str logLevel, str msg)
Write a formatted line to the log.
Represents an implementation of a logger object as called from the Logger class.