log module

binaryninja.log.close_logs() close_logs close all log files.
binaryninja.log.is_output_redirected_to_log()
binaryninja.log.log(level, text) log writes messages to the log console for the given log level.
binaryninja.log.log_alert(text) log_alert Logs message console and to a pop up window if run through the GUI.
binaryninja.log.log_debug(text) log_debug Logs debuging information messages to the console.
binaryninja.log.log_error(text) log_error Logs message to console, if run through the GUI it logs with Error icon, focusing the error console.
binaryninja.log.log_info(text) log_info Logs general information messages to the console.
binaryninja.log.log_to_file(min_level, path) log_to_file redirects minimum log level to a file named path, optionally appending rather than overwritting.
binaryninja.log.log_to_stderr(min_level) log_to_stderr redirects minimum log level to standard error.
binaryninja.log.log_to_stdout(min_level) log_to_stdout redirects minimum log level to standard out.
binaryninja.log.log_warn(text) log_warn Logs message to console, if run through the GUI it logs with Warning icon.
binaryninja.log.redirect_output_to_log()
binaryninja.log.close_logs()[source]

close_logs close all log files.

Return type:None
binaryninja.log.is_output_redirected_to_log()[source]
binaryninja.log.log(level, text)[source]

log writes messages to the log console for the given log level.

LogLevelName LogLevel Description
DebugLog 0 Logs debuging information messages to the console.
InfoLog 1 Logs general information messages to the console.
WarningLog 2 Logs message to console with Warning icon.
ErrorLog 3 Logs message to console with Error icon, focusing the error console.
AlertLog 4 Logs message to pop up window.
Parameters:
  • level (LogLevel) – Log level to use
  • text (str) – message to print
Return type:

None

binaryninja.log.log_alert(text)[source]

log_alert Logs message console and to a pop up window if run through the GUI.

Parameters:

text (str) – message to print

Return type:

None

Example:
>>> log_to_stdout(LogLevel.DebugLog)
>>> log_alert("Kielbasa!")
Kielbasa!
>>>
binaryninja.log.log_debug(text)[source]

log_debug Logs debuging information messages to the console.

Parameters:

text (str) – message to print

Return type:

None

Example:
>>> log_to_stdout(LogLevel.DebugLog)
>>> log_debug("Hotdogs!")
Hotdogs!
binaryninja.log.log_error(text)[source]

log_error Logs message to console, if run through the GUI it logs with Error icon, focusing the error console.

Parameters:

text (str) – message to print

Return type:

None

Example:
>>> log_to_stdout(LogLevel.DebugLog)
>>> log_error("Spanferkel!")
Spanferkel!
>>>
binaryninja.log.log_info(text)[source]

log_info Logs general information messages to the console.

Parameters:

text (str) – message to print

Return type:

None

Example:
>>> log_info("Saucisson!")
Saucisson!
>>>
binaryninja.log.log_to_file(min_level, path, append=False)[source]

log_to_file redirects minimum log level to a file named path, optionally appending rather than overwritting.

Parameters:
  • min_level (int) – minimum level to log to
  • path (str) – path to log to
  • append (bool) – optional flag for specifying appending. True = append, False = overwrite.
Return type:

None

binaryninja.log.log_to_stderr(min_level)[source]

log_to_stderr redirects minimum log level to standard error.

Parameters:min_level (int) – minimum level to log to
Return type:None
binaryninja.log.log_to_stdout(min_level)[source]

log_to_stdout redirects minimum log level to standard out.

Parameters:

min_level (int) – minimum level to log to

Return type:

None

Example:
>>> log_debug("Hotdogs!")
>>> log_to_stdout(LogLevel.DebugLog)
>>> log_debug("Hotdogs!")
Hotdogs!
>>>
binaryninja.log.log_warn(text)[source]

log_warn Logs message to console, if run through the GUI it logs with Warning icon.

Parameters:

text (str) – message to print

Return type:

None

Example:
>>> log_to_stdout(LogLevel.DebugLog)
>>> log_info("Chilidogs!")
Chilidogs!
>>>
binaryninja.log.redirect_output_to_log()[source]