source: loggingpy/tudelft_utilities_logging/Reporter.py@ 1380

Last change on this file since 1380 was 949, checked in by wouter, 6 months ago

#321 loggging python 1.1.0 now includes ReportToFile and ReportToLog now writes to stdout.

File size: 665 bytes
RevLine 
[204]1from abc import ABC, abstractmethod
[949]2import logging
[204]3
4class Reporter(ABC):
5 '''
6 logs events. We don't use {@link Logger} because that's not an interface and
7 is hard to stub properly because the class is protected and builds on static
8 code.
9 '''
[949]10
11 def __init__(self):
12 logging.basicConfig(level=logging.INFO)
[204]13
[949]14
[204]15 @abstractmethod
16 def log(self, level:int, msg:str, thrown:BaseException=None):
17 '''
18 Log a message, with associated Throwable information.
19
20 @param level One of the message level identifiers. Eg
21 logging.WARNING
22 @param msg The string message (or a key in the message catalog)
23 @param thrown Exception associated with log message.
24 '''
25
Note: See TracBrowser for help on using the repository browser.