BrianLogger class¶
(Shortest import: from brian2 import BrianLogger)
-
class
brian2.utils.logger.
BrianLogger
(name)[source]¶ Bases:
object
Convenience object for logging. Call
get_logger()
to get an instance of this class.Attributes
_log_messages
Class attribute for remembering log messages that should only be displayed once _pid
The pid of the process that initialized the logger – used to switch off file logging in multiprocessing contexts console_handler
The logging.StreamHandler
responsible for logging to the consoleexception_occured
Class attribute to remember whether any exception occured file_handler
The logging.FileHandler
responsible for logging to the temporary log filetmp_log
The name of the temporary log file (by default deleted after the run if no exception occurred), if any tmp_script
The name of the temporary copy of the main script file (by default deleted after the run if no exception occurred), if any Methods
debug
(msg[, name_suffix, once])Log a debug message. diagnostic
(msg[, name_suffix, once])Log a diagnostic message. error
(msg[, name_suffix, once])Log an error message. info
(msg[, name_suffix, once])Log an info message. initialize
()Initialize Brian’s logging system. log_level_debug
()Set the log level to “debug”. log_level_diagnostic
()Set the log level to “diagnostic”. log_level_error
()Set the log level to “error”. log_level_info
()Set the log level to “info”. log_level_warn
()Set the log level to “warn”. suppress_hierarchy
(name[, filter_log_file])Suppress all log messages in a given hiearchy. suppress_name
(name[, filter_log_file])Suppress all log messages with a given name. warn
(msg[, name_suffix, once])Log a warn message. Details
-
_log_messages
¶ Class attribute for remembering log messages that should only be displayed once
-
_pid
¶ The pid of the process that initialized the logger – used to switch off file logging in multiprocessing contexts
-
console_handler
¶ The
logging.StreamHandler
responsible for logging to the console
-
exception_occured
¶ Class attribute to remember whether any exception occured
-
file_handler
¶ The
logging.FileHandler
responsible for logging to the temporary log file
-
tmp_log
¶ The name of the temporary log file (by default deleted after the run if no exception occurred), if any
-
tmp_script
¶ The name of the temporary copy of the main script file (by default deleted after the run if no exception occurred), if any
-
static
initialize
()[source]¶ Initialize Brian’s logging system. This function will be called automatically when Brian is imported.
-
static
suppress_hierarchy
(name, filter_log_file=False)[source]¶ Suppress all log messages in a given hiearchy.
-