Provides functions for logging error and other messages to one or more files and/or the console, using python’s own logging module. Some warning messages and error messages are generated by PsychoPy itself. The user can generate more using the functions in this module.
There are various levels for logged messages; ranging from ERROR, through WARNING, to INFO and DEBUG. When setting the level for a particular log (file or console) the user can set the minimum level that is required for messages to enter the log. For example, setting a level of INFO will result in INFO, WARNING and ERROR messages to be recorded but not DEBUG nessages.
By default, PsychoPy will record messages of WARNING level and above to the console and INFO upwards to a psychopy.log in the current directory. The user can silence both by setting them to receive only CRITICAL messages, which (PsychoPy doesn’t use) using the commands;
from psychopy import log
log.console.setLevel(log.CRITICAL)
Creates an object to help with logging events to a file
Arguments: - filename - filemode = ‘a’(ppend) or ‘w’(rite). The latter will remove the previous file - level = the minimum level of the messages to be entered into the log - format = a string defining the format of messages - datefmt = a string specifying just the date part of the message
Returns the current level for this log (numerically) The values correspond to:
- 40:Error
- 35 Data
- 30:Warning
- 20:Info
- 10:Debug
Sets the current level for this log (numerically) The values correspond to:
- 40:Error
- 35 Data
- 30:Warning
- 20:Info
- 10:Debug