diff --git a/Logging.cs b/Logging.cs new file mode 100644 index 0000000..a388fc5 --- /dev/null +++ b/Logging.cs @@ -0,0 +1,42 @@ +using System; + +namespace BinaryNinja +{ + public static partial class Core + { + /// Routes messages at or above the given level to standard output. + public static void LogToStdout(LogLevel minimumLevel) + { + NativeMethods.BNLogToStdout(minimumLevel); + } + + /// Routes messages at or above the given level to standard error. + public static void LogToStderr(LogLevel minimumLevel) + { + NativeMethods.BNLogToStderr(minimumLevel); + } + + /// Routes messages at or above the given level to a file. + public static bool LogToFile(LogLevel minimumLevel, string path, bool append = false) + { + if (null == path) + { + throw new ArgumentNullException(nameof(path)); + } + + return NativeMethods.BNLogToFile(minimumLevel, path, append); + } + + /// Notifies registered listeners that their configuration may have changed. + public static void UpdateLogListeners() + { + NativeMethods.BNUpdateLogListeners(); + } + + /// Flushes and closes every core-managed log destination. + public static void CloseLogs() + { + NativeMethods.BNCloseLogs(); + } + } +}