Package psychopy :: Module log :: Class LogFile
[frames] | no frames]

Class LogFile

source code

Creates an object to help with logging events to a file
Instance Methods
 
__init__(self, filename, filemode='a', level=20, format='%(asctime)-s %(levelname)-8s %(message)s', dateFormat='%y-%m-%d %H:%M')
Arguments: - filename - filemode = 'a'(ppend) or 'w'(rite).
source code
 
setLevel(self, level)
Sets the current level for this log (numerically) The values correspond to:
source code
 
getLevel(self)
Returns the current level for this log (numerically) The values correspond to:
source code
 
write(self, text)
Write arbitrary text to the logfile (and no other file).
source code
 
writeline(self, text)
As LogFile.write but adds a at the end of the text
source code
Method Details

__init__(self, filename, filemode='a', level=20, format='%(asctime)-s %(levelname)-8s %(message)s', dateFormat='%y-%m-%d %H:%M')
(Constructor)

source code 
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

setLevel(self, level)

source code 

Sets the current level for this log (numerically) The values correspond to:

  • 40:Error
  • 35 Data
  • 30:Warning
  • 20:Info
  • 10:Debug

getLevel(self)

source code 

Returns the current level for this log (numerically) The values correspond to:

  • 40:Error
  • 35 Data
  • 30:Warning
  • 20:Info
  • 10:Debug

write(self, text)

source code 
Write arbitrary text to the logfile (and no other file). Consider using functions like psychopy.log.info instead, to write the message to all logfiles of a given level.