source: loggingpy/tudelft_utilities_logging/Reporter.py@ 1403

Last change on this file since 1403 was 949, checked in by wouter, 5 months ago

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

File size: 665 bytes
Line 
1from abc import ABC, abstractmethod
2import logging
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 '''
10
11 def __init__(self):
12 logging.basicConfig(level=logging.INFO)
13
14
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.