This webpage is for programmers who need examples of use of the functions of the class. The examples are designed to illustrate the syntax. They do not correspond to any meaningful model. For examples of models, visit biogeme.epfl.ch.
import datetime
print(datetime.datetime.now())
import biogeme.version as ver
print(ver.getText())
import biogeme.messaging as msg
logger = msg.bioMessage()
We consider 5 levels of reporting:
- 0: no output (silent, default for screen)
- 1: warnings only
- 2: only warnings and general information
- 3: more verbose (default for file)
- 4: debug messages
By default, the logger is silent on the screen. No message is displayed.
logger.addMessage("A test",1)
Here we ask to display all messages of level 3 or lower.
logger.setScreenLevel(3)
The following statement applies to both file and screen
logger.setDetailed()
Writing a message of a given level
logger.addMessage("A test",1)
The following statements are easier to use.
logger.general("A general message")
logger.warning("A warning message")
logger.detailed("A detailed message")
logger.debug("A debug message")
A log file can be created
theFile = logger.createLog(fileLevel=4,fileName="_test")
with open(theFile) as f:
print(f.read())