diff options
| author | Rusty Wagner <dontpanic@binaryninja.com> | 2015-03-03 16:43:50 -0500 |
|---|---|---|
| committer | Rusty Wagner <dontpanic@binaryninja.com> | 2015-03-03 16:43:50 -0500 |
| commit | 512ebc2ac144111702171d7ac8c6a1eb2d25b650 (patch) | |
| tree | 67ccfb90b837d87e7a9a640204eccc55881d7232 /binaryninjaapi.h | |
| parent | ea4cfdfef205194674fa9cb1beda4eaa56fd1fb8 (diff) | |
Add a logging system
Diffstat (limited to 'binaryninjaapi.h')
| -rw-r--r-- | binaryninjaapi.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 2c031b89..2b0d53ad 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -124,6 +124,33 @@ namespace BinaryNinja } }; + class LogListener + { + static void LogMessageCallback(void* ctxt, BNLogLevel level, const char* msg); + static void CloseLogCallback(void* ctxt); + + public: + virtual ~LogListener() {} + + static void RegisterLogListener(LogListener* listener); + static void UnregisterLogListener(LogListener* listener); + + virtual void LogMessage(BNLogLevel level, const std::string& msg) = 0; + virtual void CloseLog() {} + }; + + void Log(BNLogLevel level, const char* fmt, ...); + void LogDebug(const char* fmt, ...); + void LogInfo(const char* fmt, ...); + void LogWarn(const char* fmt, ...); + void LogError(const char* fmt, ...); + void LogAlert(const char* fmt, ...); + + void LogToStdout(BNLogLevel minimumLevel); + void LogToStderr(BNLogLevel minimumLevel); + bool LogToFile(BNLogLevel minimumLevel, const std::string& path, bool append = false); + void CloseLogs(); + class DataBuffer { BNDataBuffer* m_buffer; |
