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
Class attribute for remembering log messages that should only be displayed once
The pid of the process that initialized the logger – used to switch off file logging in multiprocessing contexts
The
logging.StreamHandler
responsible for logging to the consoleClass attribute to remember whether any exception occured
The
logging.FileHandler
responsible for logging to the temporary log fileThe name of the temporary log file (by default deleted after the run if no exception occurred), if any
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 Brian's logging system.
Set the log level to "debug".
Set the log level to "diagnostic".
Set the log level to "error".
Set the log level to "info".
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.