Binary Ninja API C++: Logging

Classes

class  BinaryNinja::LogListener
class  BinaryNinja::Logger
 Logger is a class allowing scoped logging to the console. More...
class  BinaryNinja::LogRegistry
 A class allowing registering and retrieving Loggers. More...

Functions

void BinaryNinja::Log (BNLogLevel level, const char *fmt,...)
 Logs to the error console with the given BNLogLevel.
void BinaryNinja::LogTrace (const char *fmt,...)
 LogTrace only writes text to the error console if the console is set to log level: DebugLog Log level and the build is not a DEBUG build (i.e.
void BinaryNinja::LogDebug (const char *fmt,...)
 LogDebug only writes text to the error console if the console is set to log level: DebugLog Log level DebugLog is the most verbose logging level in release builds.
void BinaryNinja::LogInfo (const char *fmt,...)
 LogInfo always writes text to the error console, and corresponds to the log level: InfoLog.
void BinaryNinja::LogWarn (const char *fmt,...)
 LogWarn writes text to the error console including a warning icon, and also shows a warning icon in the bottom pane.
void BinaryNinja::LogError (const char *fmt,...)
 LogError writes text to the error console and pops up the error console.
void BinaryNinja::LogAlert (const char *fmt,...)
 LogAlert pops up a message box displaying the alert message and logs to the error console.
void BinaryNinja::LogForException (BNLogLevel level, const std::exception &e, const char *fmt,...)
 Logs to the error console with the given BNLogLevel.
void BinaryNinja::LogTraceForException (const std::exception &e, const char *fmt,...)
 LogTraceForException only writes text to the error console if the console is set to log level: DebugLog Log level and the build is not a DEBUG build (i.e.
void BinaryNinja::LogDebugForException (const std::exception &e, const char *fmt,...)
 LogDebugForException only writes text to the error console if the console is set to log level: DebugLog Log level DebugLog is the most verbose logging level in release builds.
void BinaryNinja::LogInfoForException (const std::exception &e, const char *fmt,...)
 LogInfoForException always writes text to the error console, and corresponds to the log level: InfoLog.
void BinaryNinja::LogWarnForException (const std::exception &e, const char *fmt,...)
 LogWarnForException writes text to the error console including a warning icon, and also shows a warning icon in the bottom pane.
void BinaryNinja::LogErrorForException (const std::exception &e, const char *fmt,...)
 LogErrorForException writes text to the error console and pops up the error console.
void BinaryNinja::LogAlertForException (const std::exception &e, const char *fmt,...)
 LogAlertForException pops up a message box displaying the alert message and logs to the error console.
void BinaryNinja::LogWithStackTrace (BNLogLevel level, const char *fmt,...)
 Logs to the error console with the given BNLogLevel.
void BinaryNinja::LogTraceWithStackTrace (const char *fmt,...)
 LogTraceWithStackTrace only writes text to the error console if the console is set to log level: DebugLog Log level and the build is not a DEBUG build (i.e.
void BinaryNinja::LogDebugWithStackTrace (const char *fmt,...)
 LogDebugWithStackTrace only writes text to the error console if the console is set to log level: DebugLog Log level DebugLog is the most verbose logging level in release builds.
void BinaryNinja::LogInfoWithStackTrace (const char *fmt,...)
 LogInfoWithStackTrace always writes text to the error console, and corresponds to the log level: InfoLog.
void BinaryNinja::LogWarnWithStackTrace (const char *fmt,...)
 LogWarnWithStackTrace writes text to the error console including a warning icon, and also shows a warning icon in the bottom pane.
void BinaryNinja::LogErrorWithStackTrace (const char *fmt,...)
 LogErrorWithStackTrace writes text to the error console and pops up the error console.
void BinaryNinja::LogAlertWithStackTrace (const char *fmt,...)
 LogAlertWithStackTrace pops up a message box displaying the alert message and logs to the error console.
template<typename... T>
void BinaryNinja::LogF (BNLogLevel level, fmt::format_string< T... > format, T &&... args)
 Logs to the error console with the given BNLogLevel.
template<typename... T>
void BinaryNinja::LogTraceF (fmt::format_string< T... > format, T &&... args)
 LogTrace only writes text to the error console if the console is set to log level: DebugLog Log level and the build is not a DEBUG build (i.e.
template<typename... T>
void BinaryNinja::LogDebugF (fmt::format_string< T... > format, T &&... args)
 LogDebug only writes text to the error console if the console is set to log level: DebugLog Log level DebugLog is the most verbose logging level in release builds.
template<typename... T>
void BinaryNinja::LogInfoF (fmt::format_string< T... > format, T &&... args)
 LogInfo always writes text to the error console, and corresponds to the log level: InfoLog.
template<typename... T>
void BinaryNinja::LogWarnF (fmt::format_string< T... > format, T &&... args)
 LogWarn writes text to the error console including a warning icon, and also shows a warning icon in the bottom pane.
template<typename... T>
void BinaryNinja::LogErrorF (fmt::format_string< T... > format, T &&... args)
 LogError writes text to the error console and pops up the error console.
template<typename... T>
void BinaryNinja::LogAlertF (fmt::format_string< T... > format, T &&... args)
 LogAlert pops up a message box displaying the alert message and logs to the error console.
template<typename... T>
void BinaryNinja::LogForExceptionF (BNLogLevel level, const std::exception &e, fmt::format_string< T... > format, T &&... args)
 Logs to the error console with the given BNLogLevel.
template<typename... T>
void BinaryNinja::LogTraceForExceptionF (const std::exception &e, fmt::format_string< T... > format, T &&... args)
 LogTraceForExceptionF only writes text to the error console if the console is set to log level: DebugLog Log level and the build is not a DEBUG build (i.e.
template<typename... T>
void BinaryNinja::LogDebugForExceptionF (const std::exception &e, fmt::format_string< T... > format, T &&... args)
 LogDebugForExceptionF only writes text to the error console if the console is set to log level: DebugLog Log level DebugLog is the most verbose logging level in release builds.
template<typename... T>
void BinaryNinja::LogInfoForExceptionF (const std::exception &e, fmt::format_string< T... > format, T &&... args)
 LogInfoForExceptionF always writes text to the error console, and corresponds to the log level: InfoLog.
template<typename... T>
void BinaryNinja::LogWarnForExceptionF (const std::exception &e, fmt::format_string< T... > format, T &&... args)
 LogWarnForExceptionF writes text to the error console including a warning icon, and also shows a warning icon in the bottom pane.
template<typename... T>
void BinaryNinja::LogErrorForExceptionF (const std::exception &e, fmt::format_string< T... > format, T &&... args)
 LogErrorForExceptionF writes text to the error console and pops up the error console.
template<typename... T>
void BinaryNinja::LogAlertForExceptionF (const std::exception &e, fmt::format_string< T... > format, T &&... args)
 LogAlertForExceptionF pops up a message box displaying the alert message and logs to the error console.
template<typename... T>
void BinaryNinja::LogWithStackTraceF (BNLogLevel level, fmt::format_string< T... > format, T &&... args)
 Logs to the error console with the given BNLogLevel.
template<typename... T>
void BinaryNinja::LogTraceWithStackTraceF (fmt::format_string< T... > format, T &&... args)
 LogTraceWithStackTraceF only writes text to the error console if the console is set to log level: DebugLog Log level and the build is not a DEBUG build (i.e.
template<typename... T>
void BinaryNinja::LogDebugWithStackTraceF (fmt::format_string< T... > format, T &&... args)
 LogDebugWithStackTraceF only writes text to the error console if the console is set to log level: DebugLog Log level DebugLog is the most verbose logging level in release builds.
template<typename... T>
void BinaryNinja::LogInfoWithStackTraceF (fmt::format_string< T... > format, T &&... args)
 LogInfoWithStackTraceF always writes text to the error console, and corresponds to the log level: InfoLog.
template<typename... T>
void BinaryNinja::LogWarnWithStackTraceF (fmt::format_string< T... > format, T &&... args)
 LogWarnWithStackTraceF writes text to the error console including a warning icon, and also shows a warning icon in the bottom pane.
template<typename... T>
void BinaryNinja::LogErrorWithStackTraceF (fmt::format_string< T... > format, T &&... args)
 LogErrorWithStackTraceF writes text to the error console and pops up the error console.
template<typename... T>
void BinaryNinja::LogAlertWithStackTraceF (fmt::format_string< T... > format, T &&... args)
 LogAlertWithStackTraceF pops up a message box displaying the alert message and logs to the error console.
void BinaryNinja::LogToStdout (BNLogLevel minimumLevel)
 Redirects the minimum level passed to standard out.
void BinaryNinja::LogToStderr (BNLogLevel minimumLevel)
 Redirects the minimum level passed to standard error.
bool BinaryNinja::LogToFile (BNLogLevel minimumLevel, const std::string &path, bool append=false)
 Redirects minimum log level to the file at `path`, optionally appending rather than overwriting.
void BinaryNinja::CloseLogs ()
 Close all log files.

◆ BinaryNinja::LogListener

class BinaryNinja::LogListener

Public Member Functions

virtual ~LogListener ()
virtual void LogMessage (size_t session, BNLogLevel level, const std::string &msg, const std::string &logger_name="", size_t tid=0)=0
virtual void LogMessageWithStackTrace (size_t session, BNLogLevel level, const std::string &stackTrace, const std::string &msg, const std::string &logger_name="", size_t tid=0)
virtual void CloseLog ()
virtual BNLogLevel GetLogLevel ()

Static Public Member Functions

static void RegisterLogListener (LogListener *listener)
static void UnregisterLogListener (LogListener *listener)
static void UpdateLogListeners ()

◆ ~LogListener()

virtual BinaryNinja::LogListener::~LogListener ( )
inlinevirtual

◆ RegisterLogListener()

void LogListener::RegisterLogListener ( LogListener * listener)
static

◆ UnregisterLogListener()

void LogListener::UnregisterLogListener ( LogListener * listener)
static

◆ UpdateLogListeners()

void LogListener::UpdateLogListeners ( )
static

◆ LogMessage()

virtual void BinaryNinja::LogListener::LogMessage ( size_t session,
BNLogLevel level,
const std::string & msg,
const std::string & logger_name = "",
size_t tid = 0 )
pure virtual

◆ LogMessageWithStackTrace()

void LogListener::LogMessageWithStackTrace ( size_t session,
BNLogLevel level,
const std::string & stackTrace,
const std::string & msg,
const std::string & logger_name = "",
size_t tid = 0 )
virtual

◆ CloseLog()

virtual void BinaryNinja::LogListener::CloseLog ( )
inlinevirtual

◆ GetLogLevel()

virtual BNLogLevel BinaryNinja::LogListener::GetLogLevel ( )
inlinevirtual

◆ BinaryNinja::Logger

class BinaryNinja::Logger

Logger is a class allowing scoped logging to the console.

Public Member Functions

 Logger (BNLogger *logger)
 Logger (const std::string &loggerName, size_t sessionId=0)
 Create a logger with the specified name and session ID.
void Log (BNLogLevel level, const char *fmt,...)
 Logs to the error console with the given BNLogLevel.
void LogTrace (const char *fmt,...)
 LogTrace only writes text to the error console if the console is set to log level: DebugLog Log level and the build is not a DEBUG build (i.e.
void LogDebug (const char *fmt,...)
 LogDebug only writes text to the error console if the console is set to log level: DebugLog Log level DebugLog is the most verbose logging level in release builds.
void LogInfo (const char *fmt,...)
 LogInfo always writes text to the error console, and corresponds to the log level: InfoLog.
void LogWarn (const char *fmt,...)
 LogWarn writes text to the error console including a warning icon, and also shows a warning icon in the bottom pane.
void LogError (const char *fmt,...)
 LogError writes text to the error console and pops up the error console.
void LogAlert (const char *fmt,...)
 LogAlert pops up a message box displaying the alert message and logs to the error console.
void LogForException (BNLogLevel level, const std::exception &e, const char *fmt,...)
 Logs to the error console with the given BNLogLevel.
void LogTraceForException (const std::exception &e, const char *fmt,...)
 LogTraceForException only writes text to the error console if the console is set to log level: DebugLog Log level and the build is not a DEBUG build (i.e.
void LogDebugForException (const std::exception &e, const char *fmt,...)
 LogDebugForException only writes text to the error console if the console is set to log level: DebugLog Log level DebugLog is the most verbose logging level in release builds.
void LogInfoForException (const std::exception &e, const char *fmt,...)
 LogInfoForException always writes text to the error console, and corresponds to the log level: InfoLog.
void LogWarnForException (const std::exception &e, const char *fmt,...)
 LogWarnForException writes text to the error console including a warning icon, and also shows a warning icon in the bottom pane.
void LogErrorForException (const std::exception &e, const char *fmt,...)
 LogErrorForException writes text to the error console and pops up the error console.
void LogAlertForException (const std::exception &e, const char *fmt,...)
 LogAlertForException pops up a message box displaying the alert message and logs to the error console.
void LogWithStackTrace (BNLogLevel level, const char *fmt,...)
 Logs to the error console with the given BNLogLevel.
void LogTraceWithStackTrace (const char *fmt,...)
 LogTraceWithStackTrace only writes text to the error console if the console is set to log level: DebugLog Log level and the build is not a DEBUG build (i.e.
void LogDebugWithStackTrace (const char *fmt,...)
 LogDebugWithStackTrace only writes text to the error console if the console is set to log level: DebugLog Log level DebugLog is the most verbose logging level in release builds.
void LogInfoWithStackTrace (const char *fmt,...)
 LogInfoWithStackTrace always writes text to the error console, and corresponds to the log level: InfoLog.
void LogWarnWithStackTrace (const char *fmt,...)
 LogWarnWithStackTrace writes text to the error console including a warning icon, and also shows a warning icon in the bottom pane.
void LogErrorWithStackTrace (const char *fmt,...)
 LogErrorWithStackTrace writes text to the error console and pops up the error console.
void LogAlertWithStackTrace (const char *fmt,...)
 LogAlertWithStackTrace pops up a message box displaying the alert message and logs to the error console.
template<typename... T>
void LogF (BNLogLevel level, fmt::format_string< T... > format, T &&... args)
 Logs to the error console with the given BNLogLevel.
template<typename... T>
void LogTraceF (fmt::format_string< T... > format, T &&... args)
 LogTrace only writes text to the error console if the console is set to log level: DebugLog Log level and the build is not a DEBUG build (i.e.
template<typename... T>
void LogDebugF (fmt::format_string< T... > format, T &&... args)
 LogDebug only writes text to the error console if the console is set to log level: DebugLog Log level DebugLog is the most verbose logging level in release builds.
template<typename... T>
void LogInfoF (fmt::format_string< T... > format, T &&... args)
 LogInfo always writes text to the error console, and corresponds to the log level: InfoLog.
template<typename... T>
void LogWarnF (fmt::format_string< T... > format, T &&... args)
 LogWarn writes text to the error console including a warning icon, and also shows a warning icon in the bottom pane.
template<typename... T>
void LogErrorF (fmt::format_string< T... > format, T &&... args)
 LogError writes text to the error console and pops up the error console.
template<typename... T>
void LogAlertF (fmt::format_string< T... > format, T &&... args)
 LogAlert pops up a message box displaying the alert message and logs to the error console.
template<typename... T>
void LogForExceptionF (BNLogLevel level, const std::exception &e, fmt::format_string< T... > format, T &&... args)
 Logs to the error console with the given BNLogLevel and a stack trace.
template<typename... T>
void LogTraceForExceptionF (const std::exception &e, fmt::format_string< T... > format, T &&... args)
 LogTraceForExceptionF only writes text to the error console if the console is set to log level: DebugLog Log level and the build is not a DEBUG build (i.e.
template<typename... T>
void LogDebugForExceptionF (const std::exception &e, fmt::format_string< T... > format, T &&... args)
 LogDebugForExceptionF only writes text to the error console if the console is set to log level: DebugLog Log level DebugLog is the most verbose logging level in release builds.
template<typename... T>
void LogInfoForExceptionF (const std::exception &e, fmt::format_string< T... > format, T &&... args)
 LogInfoForExceptionF always writes text to the error console, and corresponds to the log level: InfoLog.
template<typename... T>
void LogWarnForExceptionF (const std::exception &e, fmt::format_string< T... > format, T &&... args)
 LogWarnForExceptionF writes text to the error console including a warning icon, and also shows a warning icon in the bottom pane.
template<typename... T>
void LogErrorForExceptionF (const std::exception &e, fmt::format_string< T... > format, T &&... args)
 LogErrorForExceptionF writes text to the error console and pops up the error console.
template<typename... T>
void LogAlertForExceptionF (const std::exception &e, fmt::format_string< T... > format, T &&... args)
 LogAlertForExceptionF pops up a message box displaying the alert message and logs to the error console.
template<typename... T>
void LogWithStackTraceF (BNLogLevel level, fmt::format_string< T... > format, T &&... args)
 Logs to the error console with the given BNLogLevel and a stack trace.
template<typename... T>
void LogTraceWithStackTraceF (fmt::format_string< T... > format, T &&... args)
 LogTraceWithStackTraceF only writes text to the error console if the console is set to log level: DebugLog Log level and the build is not a DEBUG build (i.e.
template<typename... T>
void LogDebugWithStackTraceF (fmt::format_string< T... > format, T &&... args)
 LogDebugWithStackTraceF only writes text to the error console if the console is set to log level: DebugLog Log level DebugLog is the most verbose logging level in release builds.
template<typename... T>
void LogInfoWithStackTraceF (fmt::format_string< T... > format, T &&... args)
 LogInfoWithStackTraceF always writes text to the error console, and corresponds to the log level: InfoLog.
template<typename... T>
void LogWarnWithStackTraceF (fmt::format_string< T... > format, T &&... args)
 LogWarnWithStackTraceF writes text to the error console including a warning icon, and also shows a warning icon in the bottom pane.
template<typename... T>
void LogErrorWithStackTraceF (fmt::format_string< T... > format, T &&... args)
 LogErrorWithStackTraceF writes text to the error console and pops up the error console.
template<typename... T>
void LogAlertWithStackTraceF (fmt::format_string< T... > format, T &&... args)
 LogAlertWithStackTraceF pops up a message box displaying the alert message and logs to the error console.
std::string GetName ()
 Get the name registered for this Logger.
size_t GetSessionId ()
 Get the session ID registered for this logger.
Public Member Functions inherited from BinaryNinja::CoreRefCountObject< BNLogger, BNNewLoggerReference, BNFreeLogger >
 CoreRefCountObject ()
virtual ~CoreRefCountObject ()
BNLoggerGetObject () const
void AddRef ()
void Release ()
void AddRefForRegistration ()
void ReleaseForRegistration ()
void AddRefForCallback ()
void ReleaseForCallback ()

Friends

struct Iterator

◆ Logger() [1/2]

◆ Logger() [2/2]

BinaryNinja::Logger::Logger ( const std::string & loggerName,
size_t sessionId = 0 )

Create a logger with the specified name and session ID.

Warning
You may want to use LogRegistry::CreateLogger and LogRegistry::GetLogger instead of this. If you already have access to a BinaryView, you may want to use bv->CreateLogger() instead of this.
See also
BinaryView::CreateLogger()

auto logger = Logger("MyPluginName", 0);

Session ID corresponds to the tab for the specified BinaryView, and the default of 0 will log to *all tabs*.

See also
FileMetadata::GetSessionId()
Parameters
loggerNameName of the logger to create
sessionIdSession ID for the logger.

◆ Log()

void Logger::Log ( BNLogLevel level,
const char * fmt,
... )

Logs to the error console with the given BNLogLevel.

Thread Safe:
Yes
Parameters
levelBNLogLevel debug log level
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogTrace()

void Logger::LogTrace ( const char * fmt,
... )

LogTrace only writes text to the error console if the console is set to log level: DebugLog Log level and the build is not a DEBUG build (i.e.

the preprocessor directive _DEBUG is defined)

Thread Safe:
Yes
Parameters
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogDebug()

void Logger::LogDebug ( const char * fmt,
... )

LogDebug only writes text to the error console if the console is set to log level: DebugLog Log level DebugLog is the most verbose logging level in release builds.

Thread Safe:
Yes
Parameters
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogInfo()

void Logger::LogInfo ( const char * fmt,
... )

LogInfo always writes text to the error console, and corresponds to the log level: InfoLog.

Log level InfoLog is the second most verbose logging level.

Thread Safe:
Yes
Parameters
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogWarn()

void Logger::LogWarn ( const char * fmt,
... )

LogWarn writes text to the error console including a warning icon, and also shows a warning icon in the bottom pane.

LogWarn corresponds to the log level: WarningLog.

Thread Safe:
Yes
Parameters
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogError()

void Logger::LogError ( const char * fmt,
... )

LogError writes text to the error console and pops up the error console.

Additionally, Errors in the console log include a error icon. LogError corresponds to the log level: ErrorLog.

Thread Safe:
Yes
Parameters
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogAlert()

void Logger::LogAlert ( const char * fmt,
... )

LogAlert pops up a message box displaying the alert message and logs to the error console.

LogAlert corresponds to the log level: AlertLog.

Thread Safe:
Yes
Parameters
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogForException()

void Logger::LogForException ( BNLogLevel level,
const std::exception & e,
const char * fmt,
... )

Logs to the error console with the given BNLogLevel.

Thread Safe:
Yes
Parameters
levelBNLogLevel debug log level
eException being handled.
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogTraceForException()

void Logger::LogTraceForException ( const std::exception & e,
const char * fmt,
... )

LogTraceForException only writes text to the error console if the console is set to log level: DebugLog Log level and the build is not a DEBUG build (i.e.

the preprocessor directive _DEBUG is defined)

Thread Safe:
Yes
Parameters
eException being handled.
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogDebugForException()

void Logger::LogDebugForException ( const std::exception & e,
const char * fmt,
... )

LogDebugForException only writes text to the error console if the console is set to log level: DebugLog Log level DebugLog is the most verbose logging level in release builds.

Thread Safe:
Yes
Parameters
eException being handled.
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogInfoForException()

void Logger::LogInfoForException ( const std::exception & e,
const char * fmt,
... )

LogInfoForException always writes text to the error console, and corresponds to the log level: InfoLog.

Log level InfoLog is the second most verbose logging level.

Thread Safe:
Yes
Parameters
eException being handled.
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogWarnForException()

void Logger::LogWarnForException ( const std::exception & e,
const char * fmt,
... )

LogWarnForException writes text to the error console including a warning icon, and also shows a warning icon in the bottom pane.

LogWarn corresponds to the log level: WarningLog.

Thread Safe:
Yes
Parameters
eException being handled.
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogErrorForException()

void Logger::LogErrorForException ( const std::exception & e,
const char * fmt,
... )

LogErrorForException writes text to the error console and pops up the error console.

Additionally, Errors in the console log include a error icon. LogError corresponds to the log level: ErrorLog.

Thread Safe:
Yes
Parameters
eException being handled.
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogAlertForException()

void Logger::LogAlertForException ( const std::exception & e,
const char * fmt,
... )

LogAlertForException pops up a message box displaying the alert message and logs to the error console.

LogAlert corresponds to the log level: AlertLog.

Thread Safe:
Yes
Parameters
eException being handled.
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogWithStackTrace()

void Logger::LogWithStackTrace ( BNLogLevel level,
const char * fmt,
... )

Logs to the error console with the given BNLogLevel.

Thread Safe:
Yes
Parameters
levelBNLogLevel debug log level
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogTraceWithStackTrace()

void Logger::LogTraceWithStackTrace ( const char * fmt,
... )

LogTraceWithStackTrace only writes text to the error console if the console is set to log level: DebugLog Log level and the build is not a DEBUG build (i.e.

the preprocessor directive _DEBUG is defined)

Thread Safe:
Yes
Parameters
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogDebugWithStackTrace()

void Logger::LogDebugWithStackTrace ( const char * fmt,
... )

LogDebugWithStackTrace only writes text to the error console if the console is set to log level: DebugLog Log level DebugLog is the most verbose logging level in release builds.

Thread Safe:
Yes
Parameters
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogInfoWithStackTrace()

void Logger::LogInfoWithStackTrace ( const char * fmt,
... )

LogInfoWithStackTrace always writes text to the error console, and corresponds to the log level: InfoLog.

Log level InfoLog is the second most verbose logging level.

Thread Safe:
Yes
Parameters
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogWarnWithStackTrace()

void Logger::LogWarnWithStackTrace ( const char * fmt,
... )

LogWarnWithStackTrace writes text to the error console including a warning icon, and also shows a warning icon in the bottom pane.

LogWarn corresponds to the log level: WarningLog.

Thread Safe:
Yes
Parameters
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogErrorWithStackTrace()

void Logger::LogErrorWithStackTrace ( const char * fmt,
... )

LogErrorWithStackTrace writes text to the error console and pops up the error console.

Additionally, Errors in the console log include a error icon. LogError corresponds to the log level: ErrorLog.

Thread Safe:
Yes
Parameters
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogAlertWithStackTrace()

void Logger::LogAlertWithStackTrace ( const char * fmt,
... )

LogAlertWithStackTrace pops up a message box displaying the alert message and logs to the error console.

LogAlert corresponds to the log level: AlertLog.

Thread Safe:
Yes
Parameters
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogF()

template<typename... T>

void BinaryNinja::Logger::LogF ( BNLogLevel level,
fmt::format_string< T... > format,
T &&... args )
inline

Logs to the error console with the given BNLogLevel.

Thread Safe:
Yes
Parameters
levelBNLogLevel debug log level
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogTraceF()

template<typename... T>

void BinaryNinja::Logger::LogTraceF ( fmt::format_string< T... > format,
T &&... args )
inline

LogTrace only writes text to the error console if the console is set to log level: DebugLog Log level and the build is not a DEBUG build (i.e.

the preprocessor directive _DEBUG is defined)

Thread Safe:
Yes
Parameters
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogDebugF()

template<typename... T>

void BinaryNinja::Logger::LogDebugF ( fmt::format_string< T... > format,
T &&... args )
inline

LogDebug only writes text to the error console if the console is set to log level: DebugLog Log level DebugLog is the most verbose logging level in release builds.

Thread Safe:
Yes
Parameters
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogInfoF()

template<typename... T>

void BinaryNinja::Logger::LogInfoF ( fmt::format_string< T... > format,
T &&... args )
inline

LogInfo always writes text to the error console, and corresponds to the log level: InfoLog.

Log level InfoLog is the second most verbose logging level.

Thread Safe:
Yes
Parameters
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogWarnF()

template<typename... T>

void BinaryNinja::Logger::LogWarnF ( fmt::format_string< T... > format,
T &&... args )
inline

LogWarn writes text to the error console including a warning icon, and also shows a warning icon in the bottom pane.

LogWarn corresponds to the log level: WarningLog.

Thread Safe:
Yes
Parameters
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogErrorF()

template<typename... T>

void BinaryNinja::Logger::LogErrorF ( fmt::format_string< T... > format,
T &&... args )
inline

LogError writes text to the error console and pops up the error console.

Additionally, Errors in the console log include a error icon. LogError corresponds to the log level: ErrorLog.

Thread Safe:
Yes
Parameters
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogAlertF()

template<typename... T>

void BinaryNinja::Logger::LogAlertF ( fmt::format_string< T... > format,
T &&... args )
inline

LogAlert pops up a message box displaying the alert message and logs to the error console.

LogAlert corresponds to the log level: AlertLog.

Thread Safe:
Yes
Parameters
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogForExceptionF()

template<typename... T>

void BinaryNinja::Logger::LogForExceptionF ( BNLogLevel level,
const std::exception & e,
fmt::format_string< T... > format,
T &&... args )
inline

Logs to the error console with the given BNLogLevel and a stack trace.

Thread Safe:
Yes
Parameters
levelBNLogLevel debug log level
eException being handled.
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogTraceForExceptionF()

template<typename... T>

void BinaryNinja::Logger::LogTraceForExceptionF ( const std::exception & e,
fmt::format_string< T... > format,
T &&... args )
inline

LogTraceForExceptionF only writes text to the error console if the console is set to log level: DebugLog Log level and the build is not a DEBUG build (i.e.

the preprocessor directive _DEBUG is defined)

Thread Safe:
Yes
Parameters
eException being handled.
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogDebugForExceptionF()

template<typename... T>

void BinaryNinja::Logger::LogDebugForExceptionF ( const std::exception & e,
fmt::format_string< T... > format,
T &&... args )
inline

LogDebugForExceptionF only writes text to the error console if the console is set to log level: DebugLog Log level DebugLog is the most verbose logging level in release builds.

Thread Safe:
Yes
Parameters
eException being handled.
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogInfoForExceptionF()

template<typename... T>

void BinaryNinja::Logger::LogInfoForExceptionF ( const std::exception & e,
fmt::format_string< T... > format,
T &&... args )
inline

LogInfoForExceptionF always writes text to the error console, and corresponds to the log level: InfoLog.

Log level InfoLog is the second most verbose logging level.

Thread Safe:
Yes
Parameters
eException being handled.
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogWarnForExceptionF()

template<typename... T>

void BinaryNinja::Logger::LogWarnForExceptionF ( const std::exception & e,
fmt::format_string< T... > format,
T &&... args )
inline

LogWarnForExceptionF writes text to the error console including a warning icon, and also shows a warning icon in the bottom pane.

LogWarn corresponds to the log level: WarningLog.

Thread Safe:
Yes
Parameters
eException being handled.
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogErrorForExceptionF()

template<typename... T>

void BinaryNinja::Logger::LogErrorForExceptionF ( const std::exception & e,
fmt::format_string< T... > format,
T &&... args )
inline

LogErrorForExceptionF writes text to the error console and pops up the error console.

Additionally, Errors in the console log include a error icon. LogError corresponds to the log level: ErrorLog.

Thread Safe:
Yes
Parameters
eException being handled.
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogAlertForExceptionF()

template<typename... T>

void BinaryNinja::Logger::LogAlertForExceptionF ( const std::exception & e,
fmt::format_string< T... > format,
T &&... args )
inline

LogAlertForExceptionF pops up a message box displaying the alert message and logs to the error console.

LogAlert corresponds to the log level: AlertLog.

Thread Safe:
Yes
Parameters
eException being handled.
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogWithStackTraceF()

template<typename... T>

void BinaryNinja::Logger::LogWithStackTraceF ( BNLogLevel level,
fmt::format_string< T... > format,
T &&... args )
inline

Logs to the error console with the given BNLogLevel and a stack trace.

Thread Safe:
Yes
Parameters
levelBNLogLevel debug log level
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogTraceWithStackTraceF()

template<typename... T>

void BinaryNinja::Logger::LogTraceWithStackTraceF ( fmt::format_string< T... > format,
T &&... args )
inline

LogTraceWithStackTraceF only writes text to the error console if the console is set to log level: DebugLog Log level and the build is not a DEBUG build (i.e.

the preprocessor directive _DEBUG is defined)

Thread Safe:
Yes
Parameters
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogDebugWithStackTraceF()

template<typename... T>

void BinaryNinja::Logger::LogDebugWithStackTraceF ( fmt::format_string< T... > format,
T &&... args )
inline

LogDebugWithStackTraceF only writes text to the error console if the console is set to log level: DebugLog Log level DebugLog is the most verbose logging level in release builds.

Thread Safe:
Yes
Parameters
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogInfoWithStackTraceF()

template<typename... T>

void BinaryNinja::Logger::LogInfoWithStackTraceF ( fmt::format_string< T... > format,
T &&... args )
inline

LogInfoWithStackTraceF always writes text to the error console, and corresponds to the log level: InfoLog.

Log level InfoLog is the second most verbose logging level.

Thread Safe:
Yes
Parameters
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogWarnWithStackTraceF()

template<typename... T>

void BinaryNinja::Logger::LogWarnWithStackTraceF ( fmt::format_string< T... > format,
T &&... args )
inline

LogWarnWithStackTraceF writes text to the error console including a warning icon, and also shows a warning icon in the bottom pane.

LogWarn corresponds to the log level: WarningLog.

Thread Safe:
Yes
Parameters
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogErrorWithStackTraceF()

template<typename... T>

void BinaryNinja::Logger::LogErrorWithStackTraceF ( fmt::format_string< T... > format,
T &&... args )
inline

LogErrorWithStackTraceF writes text to the error console and pops up the error console.

Additionally, Errors in the console log include a error icon. LogError corresponds to the log level: ErrorLog.

Thread Safe:
Yes
Parameters
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogAlertWithStackTraceF()

template<typename... T>

void BinaryNinja::Logger::LogAlertWithStackTraceF ( fmt::format_string< T... > format,
T &&... args )
inline

LogAlertWithStackTraceF pops up a message box displaying the alert message and logs to the error console.

LogAlert corresponds to the log level: AlertLog.

Thread Safe:
Yes
Parameters
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ GetName()

string Logger::GetName ( )

Get the name registered for this Logger.

Thread Safe:
Yes
Returns
The logger name

◆ GetSessionId()

size_t Logger::GetSessionId ( )

Get the session ID registered for this logger.

Thread Safe:
Yes
Returns
The logger session ID

◆ Iterator

◆ BinaryNinja::LogRegistry

class BinaryNinja::LogRegistry

A class allowing registering and retrieving Loggers.

See also
BinaryView::CreateLogger

Static Public Member Functions

static Ref< LoggerCreateLogger (const std::string &loggerName, size_t sessionId=0)
 Create a logger with the specified name and session ID.
static Ref< LoggerGetLogger (const std::string &loggerName, size_t sessionId=0)
 Get a logger with the specified name and session ID.
static std::vector< std::string > GetLoggerNames ()
 Get the list of registered Logger names.

◆ CreateLogger()

Ref< Logger > LogRegistry::CreateLogger ( const std::string & loggerName,
size_t sessionId = 0 )
static

Create a logger with the specified name and session ID.

Thread Safe:
Yes
Note
If you already have a BinaryView, you may want to use BinaryView::CreateLogger instead of this.

auto sessionID = bv->GetFile()->GetSessionId();

auto logger = LogRegistry::CreateLogger("MyPluginName", sessionID);

Session ID corresponds to the tab for the specified BinaryView, and the default of 0 will log to *all tabs*.

See also
FileMetadata::GetSessionId()
Parameters
loggerNameName of the logger to create
sessionIdSession ID for the logger
Returns
The created logger

◆ GetLogger()

Ref< Logger > LogRegistry::GetLogger ( const std::string & loggerName,
size_t sessionId = 0 )
static

Get a logger with the specified name and session ID.

Thread Safe:
Yes

auto sessionID = bv->GetFile()->GetSessionId();

auto logger = LogRegistry::GetLogger("MyPluginName", sessionID);

Session ID corresponds to the tab for the specified BinaryView, and the default of 0 will log to *all tabs*.

See also
FileMetadata::GetSessionId()
Parameters
loggerNameName of the logger to create
sessionIdSession ID for the logger
Returns
The created logger

◆ GetLoggerNames()

vector< string > LogRegistry::GetLoggerNames ( )
static

Get the list of registered Logger names.

Thread Safe:
Yes
Returns
a list of registered logger names

◆ Log()

void BinaryNinja::Log ( BNLogLevel level,
const char * fmt,
... )

Logs to the error console with the given BNLogLevel.

Thread Safe:
Yes
Parameters
levelBNLogLevel debug log level
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogTrace()

void BinaryNinja::LogTrace ( const char * fmt,
... )

LogTrace only writes text to the error console if the console is set to log level: DebugLog Log level and the build is not a DEBUG build (i.e.

the preprocessor directive _DEBUG is defined)

Thread Safe:
Yes
Parameters
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogDebug()

void BinaryNinja::LogDebug ( const char * fmt,
... )

LogDebug only writes text to the error console if the console is set to log level: DebugLog Log level DebugLog is the most verbose logging level in release builds.

Thread Safe:
Yes
Parameters
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogInfo()

void BinaryNinja::LogInfo ( const char * fmt,
... )

LogInfo always writes text to the error console, and corresponds to the log level: InfoLog.

Log level InfoLog is the second most verbose logging level.

Thread Safe:
Yes
Parameters
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogWarn()

void BinaryNinja::LogWarn ( const char * fmt,
... )

LogWarn writes text to the error console including a warning icon, and also shows a warning icon in the bottom pane.

LogWarn corresponds to the log level: WarningLog.

Thread Safe:
Yes
Parameters
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogError()

void BinaryNinja::LogError ( const char * fmt,
... )

LogError writes text to the error console and pops up the error console.

Additionally, Errors in the console log include a error icon. LogError corresponds to the log level: ErrorLog.

Thread Safe:
Yes
Parameters
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogAlert()

void BinaryNinja::LogAlert ( const char * fmt,
... )

LogAlert pops up a message box displaying the alert message and logs to the error console.

LogAlert corresponds to the log level: AlertLog.

Thread Safe:
Yes
Parameters
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogForException()

void BinaryNinja::LogForException ( BNLogLevel level,
const std::exception & e,
const char * fmt,
... )

Logs to the error console with the given BNLogLevel.

Thread Safe:
Yes
Parameters
levelBNLogLevel debug log level
eException being handled.
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogTraceForException()

void BinaryNinja::LogTraceForException ( const std::exception & e,
const char * fmt,
... )

LogTraceForException only writes text to the error console if the console is set to log level: DebugLog Log level and the build is not a DEBUG build (i.e.

the preprocessor directive _DEBUG is defined)

Thread Safe:
Yes
Parameters
eException being handled.
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogDebugForException()

void BinaryNinja::LogDebugForException ( const std::exception & e,
const char * fmt,
... )

LogDebugForException only writes text to the error console if the console is set to log level: DebugLog Log level DebugLog is the most verbose logging level in release builds.

Thread Safe:
Yes
Parameters
eException being handled.
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogInfoForException()

void BinaryNinja::LogInfoForException ( const std::exception & e,
const char * fmt,
... )

LogInfoForException always writes text to the error console, and corresponds to the log level: InfoLog.

Log level InfoLog is the second most verbose logging level.

Thread Safe:
Yes
Parameters
eException being handled.
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogWarnForException()

void BinaryNinja::LogWarnForException ( const std::exception & e,
const char * fmt,
... )

LogWarnForException writes text to the error console including a warning icon, and also shows a warning icon in the bottom pane.

LogWarn corresponds to the log level: WarningLog.

Thread Safe:
Yes
Parameters
eException being handled.
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogErrorForException()

void BinaryNinja::LogErrorForException ( const std::exception & e,
const char * fmt,
... )

LogErrorForException writes text to the error console and pops up the error console.

Additionally, Errors in the console log include a error icon. LogError corresponds to the log level: ErrorLog.

Thread Safe:
Yes
Parameters
eException being handled.
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogAlertForException()

void BinaryNinja::LogAlertForException ( const std::exception & e,
const char * fmt,
... )

LogAlertForException pops up a message box displaying the alert message and logs to the error console.

LogAlert corresponds to the log level: AlertLog.

Thread Safe:
Yes
Parameters
eException being handled.
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogWithStackTrace()

void BinaryNinja::LogWithStackTrace ( BNLogLevel level,
const char * fmt,
... )

Logs to the error console with the given BNLogLevel.

Thread Safe:
Yes
Parameters
levelBNLogLevel debug log level
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogTraceWithStackTrace()

void BinaryNinja::LogTraceWithStackTrace ( const char * fmt,
... )

LogTraceWithStackTrace only writes text to the error console if the console is set to log level: DebugLog Log level and the build is not a DEBUG build (i.e.

the preprocessor directive _DEBUG is defined)

Thread Safe:
Yes
Parameters
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogDebugWithStackTrace()

void BinaryNinja::LogDebugWithStackTrace ( const char * fmt,
... )

LogDebugWithStackTrace only writes text to the error console if the console is set to log level: DebugLog Log level DebugLog is the most verbose logging level in release builds.

Thread Safe:
Yes
Parameters
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogInfoWithStackTrace()

void BinaryNinja::LogInfoWithStackTrace ( const char * fmt,
... )

LogInfoWithStackTrace always writes text to the error console, and corresponds to the log level: InfoLog.

Log level InfoLog is the second most verbose logging level.

Thread Safe:
Yes
Parameters
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogWarnWithStackTrace()

void BinaryNinja::LogWarnWithStackTrace ( const char * fmt,
... )

LogWarnWithStackTrace writes text to the error console including a warning icon, and also shows a warning icon in the bottom pane.

LogWarn corresponds to the log level: WarningLog.

Thread Safe:
Yes
Parameters
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogErrorWithStackTrace()

void BinaryNinja::LogErrorWithStackTrace ( const char * fmt,
... )

LogErrorWithStackTrace writes text to the error console and pops up the error console.

Additionally, Errors in the console log include a error icon. LogError corresponds to the log level: ErrorLog.

Thread Safe:
Yes
Parameters
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogAlertWithStackTrace()

void BinaryNinja::LogAlertWithStackTrace ( const char * fmt,
... )

LogAlertWithStackTrace pops up a message box displaying the alert message and logs to the error console.

LogAlert corresponds to the log level: AlertLog.

Thread Safe:
Yes
Parameters
fmtC-style format string.
...Variable arguments corresponding to the format string.

◆ LogF()

template<typename... T>

void BinaryNinja::LogF ( BNLogLevel level,
fmt::format_string< T... > format,
T &&... args )

Logs to the error console with the given BNLogLevel.

Thread Safe:
Yes
Parameters
levelBNLogLevel debug log level
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogTraceF()

template<typename... T>

void BinaryNinja::LogTraceF ( fmt::format_string< T... > format,
T &&... args )

LogTrace only writes text to the error console if the console is set to log level: DebugLog Log level and the build is not a DEBUG build (i.e.

the preprocessor directive _DEBUG is defined)

Thread Safe:
Yes
Parameters
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogDebugF()

template<typename... T>

void BinaryNinja::LogDebugF ( fmt::format_string< T... > format,
T &&... args )

LogDebug only writes text to the error console if the console is set to log level: DebugLog Log level DebugLog is the most verbose logging level in release builds.

Thread Safe:
Yes
Parameters
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogInfoF()

template<typename... T>

void BinaryNinja::LogInfoF ( fmt::format_string< T... > format,
T &&... args )

LogInfo always writes text to the error console, and corresponds to the log level: InfoLog.

Log level InfoLog is the second most verbose logging level.

Thread Safe:
Yes
Parameters
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogWarnF()

template<typename... T>

void BinaryNinja::LogWarnF ( fmt::format_string< T... > format,
T &&... args )

LogWarn writes text to the error console including a warning icon, and also shows a warning icon in the bottom pane.

LogWarn corresponds to the log level: WarningLog.

Thread Safe:
Yes
Parameters
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogErrorF()

template<typename... T>

void BinaryNinja::LogErrorF ( fmt::format_string< T... > format,
T &&... args )

LogError writes text to the error console and pops up the error console.

Additionally, Errors in the console log include a error icon. LogError corresponds to the log level: ErrorLog.

Thread Safe:
Yes
Parameters
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogAlertF()

template<typename... T>

void BinaryNinja::LogAlertF ( fmt::format_string< T... > format,
T &&... args )

LogAlert pops up a message box displaying the alert message and logs to the error console.

LogAlert corresponds to the log level: AlertLog.

Thread Safe:
Yes
Parameters
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogForExceptionF()

template<typename... T>

void BinaryNinja::LogForExceptionF ( BNLogLevel level,
const std::exception & e,
fmt::format_string< T... > format,
T &&... args )

Logs to the error console with the given BNLogLevel.

Thread Safe:
Yes
Parameters
levelBNLogLevel debug log level
eException being handled.
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogTraceForExceptionF()

template<typename... T>

void BinaryNinja::LogTraceForExceptionF ( const std::exception & e,
fmt::format_string< T... > format,
T &&... args )

LogTraceForExceptionF only writes text to the error console if the console is set to log level: DebugLog Log level and the build is not a DEBUG build (i.e.

the preprocessor directive _DEBUG is defined)

Thread Safe:
Yes
Parameters
eException being handled.
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogDebugForExceptionF()

template<typename... T>

void BinaryNinja::LogDebugForExceptionF ( const std::exception & e,
fmt::format_string< T... > format,
T &&... args )

LogDebugForExceptionF only writes text to the error console if the console is set to log level: DebugLog Log level DebugLog is the most verbose logging level in release builds.

Thread Safe:
Yes
Parameters
eException being handled.
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogInfoForExceptionF()

template<typename... T>

void BinaryNinja::LogInfoForExceptionF ( const std::exception & e,
fmt::format_string< T... > format,
T &&... args )

LogInfoForExceptionF always writes text to the error console, and corresponds to the log level: InfoLog.

Log level InfoLog is the second most verbose logging level.

Thread Safe:
Yes
Parameters
eException being handled.
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogWarnForExceptionF()

template<typename... T>

void BinaryNinja::LogWarnForExceptionF ( const std::exception & e,
fmt::format_string< T... > format,
T &&... args )

LogWarnForExceptionF writes text to the error console including a warning icon, and also shows a warning icon in the bottom pane.

LogWarn corresponds to the log level: WarningLog.

Thread Safe:
Yes
Parameters
eException being handled.
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogErrorForExceptionF()

template<typename... T>

void BinaryNinja::LogErrorForExceptionF ( const std::exception & e,
fmt::format_string< T... > format,
T &&... args )

LogErrorForExceptionF writes text to the error console and pops up the error console.

Additionally, Errors in the console log include a error icon. LogError corresponds to the log level: ErrorLog.

Thread Safe:
Yes
Parameters
eException being handled.
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogAlertForExceptionF()

template<typename... T>

void BinaryNinja::LogAlertForExceptionF ( const std::exception & e,
fmt::format_string< T... > format,
T &&... args )

LogAlertForExceptionF pops up a message box displaying the alert message and logs to the error console.

LogAlert corresponds to the log level: AlertLog.

Thread Safe:
Yes
Parameters
eException being handled.
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogWithStackTraceF()

template<typename... T>

void BinaryNinja::LogWithStackTraceF ( BNLogLevel level,
fmt::format_string< T... > format,
T &&... args )

Logs to the error console with the given BNLogLevel.

Thread Safe:
Yes
Parameters
levelBNLogLevel debug log level
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogTraceWithStackTraceF()

template<typename... T>

void BinaryNinja::LogTraceWithStackTraceF ( fmt::format_string< T... > format,
T &&... args )

LogTraceWithStackTraceF only writes text to the error console if the console is set to log level: DebugLog Log level and the build is not a DEBUG build (i.e.

the preprocessor directive _DEBUG is defined)

Thread Safe:
Yes
Parameters
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogDebugWithStackTraceF()

template<typename... T>

void BinaryNinja::LogDebugWithStackTraceF ( fmt::format_string< T... > format,
T &&... args )

LogDebugWithStackTraceF only writes text to the error console if the console is set to log level: DebugLog Log level DebugLog is the most verbose logging level in release builds.

Thread Safe:
Yes
Parameters
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogInfoWithStackTraceF()

template<typename... T>

void BinaryNinja::LogInfoWithStackTraceF ( fmt::format_string< T... > format,
T &&... args )

LogInfoWithStackTraceF always writes text to the error console, and corresponds to the log level: InfoLog.

Log level InfoLog is the second most verbose logging level.

Thread Safe:
Yes
Parameters
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogWarnWithStackTraceF()

template<typename... T>

void BinaryNinja::LogWarnWithStackTraceF ( fmt::format_string< T... > format,
T &&... args )

LogWarnWithStackTraceF writes text to the error console including a warning icon, and also shows a warning icon in the bottom pane.

LogWarn corresponds to the log level: WarningLog.

Thread Safe:
Yes
Parameters
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogErrorWithStackTraceF()

template<typename... T>

void BinaryNinja::LogErrorWithStackTraceF ( fmt::format_string< T... > format,
T &&... args )

LogErrorWithStackTraceF writes text to the error console and pops up the error console.

Additionally, Errors in the console log include a error icon. LogError corresponds to the log level: ErrorLog.

Thread Safe:
Yes
Parameters
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogAlertWithStackTraceF()

template<typename... T>

void BinaryNinja::LogAlertWithStackTraceF ( fmt::format_string< T... > format,
T &&... args )

LogAlertWithStackTraceF pops up a message box displaying the alert message and logs to the error console.

LogAlert corresponds to the log level: AlertLog.

Thread Safe:
Yes
Parameters
formatfmt-style format string.
...Variable arguments corresponding to the format string.

◆ LogToStdout()

void BinaryNinja::LogToStdout ( BNLogLevel minimumLevel)

Redirects the minimum level passed to standard out.

Thread Safe:
Yes
Parameters
minimumLevelminimum level to log to stdout

◆ LogToStderr()

void BinaryNinja::LogToStderr ( BNLogLevel minimumLevel)

Redirects the minimum level passed to standard error.

Thread Safe:
Yes
Parameters
minimumLevelminimum level to log to stderr

◆ LogToFile()

bool BinaryNinja::LogToFile ( BNLogLevel minimumLevel,
const std::string & path,
bool append = false )

Redirects minimum log level to the file at `path`, optionally appending rather than overwriting.

Thread Safe:
Yes
Parameters
minimumLevelminimum level to log to stderr
pathPath to log to
appendOptional flag for specifying appending. True = append, False = overwrite.

◆ CloseLogs()

void BinaryNinja::CloseLogs ( )

Close all log files.