Messaging
The biogeme.messaging module is a logger to manage the verbosity of the package.
biogeme.messaging module
Singleton managing the various levels of messages
- author
Michel Bierlaire
- date
Mon Jul 22 16:12:00 2019
- class biogeme.messaging.bioMessage(*args, **kwargs)[source]
Bases:
object
Manages the Biogeme messages
- __init__(screenLevel=1)[source]
Constructor
- Parameters
screenLevel (int) –
level of message that must be displayed on the screen:
0: no output (default)
1: warnings only
2: only warnings and general information
3: more verbose
4: debug messages
- addMessage(text, level)[source]
Add a message
- Parameters
text (string) – text of the message.
level (int) –
level of the message
1: warning
2: general information
3: detailed information
4: debug message
- Note
adding a message of level 0 is meaningless, as it correspond to silentmode.
- allMessages(screenLevel=None)[source]
Report all the messages up to a given level.
- Parameters
screenLevel (int) –
level of message that must be reported in the file:
0: no output
1: warnings only
2: only warnings and general information
3: more verbose (default)
4: debug messages
If None (default), all messages are reported.
- Returns
all messages.
- Return type
str.
- createLog(fileLevel=None, fileName='_biogeme')[source]
Creates a log file
- Parameters
fileLevel (int) –
level of message that must be reported in the file:
0: no output
1: warnings only
2: only warnings and general information
3: more verbose (default)
4: debug messages
If None (default), all messages are reported.
fileName (string) – name of the file (without extension). Default: ‘_biogeme’. A file called _biogeme.log will be created.
- Returns
name of the file
- Return type
str
- lastLevel
last level used
- screenLevel
screen verbosity level
- setScreenLevel(level)[source]
Change the level of messaging for the screen
- Parameters
level (int) –
level of message that must be displayed on the screen:
0: no output
1: warnings only
2: only warnings and general information
3: more verbose
4: debug messages
- temporarySilence()[source]
Temporarily turns off the message, remembering the current screen level.
- types
names of verbosity levels