private static void LiteCoreLog(C4LogDomain* domain, C4LogLevel level, IntPtr message, IntPtr ignored) { // Not the best place to do this, but otherwise we have to require the developer // To signal us when they change the log level RecalculateLevel(); var domainName = Native.c4log_getDomainName(domain); var logDomain = To.DomainForString(domainName); var actualMessage = message.ToUTF8String(); Database.Log.Console.Log((LogLevel)level, logDomain, actualMessage); Database.Log.Custom?.Log((LogLevel)level, logDomain, actualMessage); }
private static void LiteCoreLog(C4LogDomain *domain, C4LogLevel level, string message, IntPtr ignored) { var domainName = Native.c4log_getDomainName(domain); foreach (var logger in To.All) { if (logger.Domain == domainName) { logger.QuickWrite(level, message, TextLogger); return; } } To.LiteCore.QuickWrite(level, message, TextLogger); }
public static extern void c4log_setLevel(C4LogDomain *c4Domain, C4LogLevel level);
public static extern void c4log_setCallbackLevel(C4LogLevel level);
public static extern void c4slog(C4LogDomain *domain, C4LogLevel level, FLSlice msg);
private static void Log(C4LogLevel level, string message) { string[] levelNames = new[] { "debug", "info", "WARNING", "ERROR" }; Console.Error.WriteLineAsync(String.Format("CBForest-C {0}: {1}", levelNames[(int)level], message)); }
private static void c4log_wedge(C4LogLevel level, C4Slice message) { if (_LogCallback != null) { var sharpString = (string)message; _LogCallback(level, sharpString); } }
private static extern void c4log_register(C4LogLevel level, C4LogCallback callback);
public static extern bool c4log_writeToBinaryFile(C4LogLevel level, FLSlice path, C4Error *error);
public static void c4slog(C4LogDomain *domain, C4LogLevel level, string msg) => Impl.c4slog(domain, level, msg);
public static void c4log_setLevel(C4LogDomain *c4Domain, C4LogLevel level) => Impl.c4log_setLevel(c4Domain, level);
public static void c4log_setBinaryFileLevel(C4LogLevel level) => Impl.c4log_setBinaryFileLevel(level);
public static void c4log_setCallbackLevel(C4LogLevel level) => Impl.c4log_setCallbackLevel(level);
public static extern void c4log_setLevel(C4LogLevel level);
public static bool c4log_writeToBinaryFile(C4LogLevel level, C4Slice path, C4Error *error) => Impl.c4log_writeToBinaryFile(level, path, error);
public static extern void c4log_register(C4LogLevel level, C4LogCallback callback);
public bool c4log_writeToBinaryFile(C4LogLevel level, C4Slice path, C4Error *error) => NativeRaw.c4log_writeToBinaryFile(level, path, error);
public static bool c4log_writeToBinaryFile(C4LogLevel level, string path, C4Error *error) { using (var path_ = new C4String(path)) { return(NativeRaw.c4log_writeToBinaryFile(level, path_.AsFLSlice(), error)); } }
public void c4slog(C4LogDomain *domain, C4LogLevel level, C4Slice msg) => NativeRaw.c4slog(domain, level, msg);
public static void c4log_register(C4LogLevel level, Action<C4LogLevel, string> callback) { _LogCallback = callback; // This is needed to ensure that the delegate object itself doesn't get garbage collected _NativeLogCallback = _LogCallback == null ? null : new C4LogCallback(c4log_wedge); c4log_register(level, _NativeLogCallback); }
public void c4log_writeToCallback(C4LogLevel level, C4LogCallback callback, bool preformatted) => Native.c4log_writeToCallback(level, callback, preformatted);
private static void Log(C4LogLevel level, C4Slice message) { string[] levelNames = new[] { "debug", "info", "WARNING", "ERROR" }; Console.Error.WriteLineAsync(String.Format("CBForest-C {0}: {1}", levelNames[(int)level], (string)message)); }
public bool c4log_writeToBinaryFile(C4LogLevel level, string path, C4Error *error) => Native.c4log_writeToBinaryFile(level, path, error);
private void Log(C4LogLevel level, C4Slice s) { WriteLine($"[{level}] {s.CreateString()}"); }
public void c4log_setCallbackLevel(C4LogLevel level) => Native.c4log_setCallbackLevel(level);
public static extern void c4log_writeToCallback(C4LogLevel level, C4LogCallback callback, [MarshalAs(UnmanagedType.U1)] bool preformatted);
public void c4log_setBinaryFileLevel(C4LogLevel level) => Native.c4log_setBinaryFileLevel(level);
public static extern void c4log_setBinaryFileLevel(C4LogLevel level);
public void c4log_setLevel(C4LogDomain *c4Domain, C4LogLevel level) => Native.c4log_setLevel(c4Domain, level);
public static void c4slog(C4LogDomain *domain, C4LogLevel level, string msg) { using (var msg_ = new C4String(msg)) { NativeRaw.c4slog(domain, level, msg_.AsFLSlice()); } }
public void c4slog(C4LogDomain *domain, C4LogLevel level, string msg) => Native.c4slog(domain, level, msg);