public static void Log(string m, LogInfo l, string suggestedAction) { if (BSIPALogger == null) { return; } IPALogger.Level level = IPALogger.Level.Debug; switch (l) { case LogInfo.Info: level = IPALogger.Level.Debug; break; case LogInfo.Notice: level = IPALogger.Level.Notice; break; case LogInfo.Warning: level = IPALogger.Level.Warning; break; case LogInfo.Error: level = IPALogger.Level.Error; break; case LogInfo.Fatal: level = IPALogger.Level.Critical; break; } BSIPALogger.Log(level, m); if (suggestedAction != null) { BSIPALogger.Log(level, $"Suggested Action: {suggestedAction}"); } }
internal static void Log(GameObject message, Level level = Level.Info) { try { Log(message.GetFullPath(), level); } catch (Exception e) { Log(e, Level.Error); } }
internal static void Log(object message, Level level = Level.Info) { try { Log(message.ToString(), level); } catch (Exception e) { Log(e, Level.Error); } }
internal static void Log(Exception e, Level level = Level.Notice) { Log("An error has been caught:\n" + e.GetType().Name + "\nAt:\n" + e.StackTrace + "\nWith message:\n" + e.Message, level); if (e.InnerException != null) { Log("---Inner Exception:---", level); Log(e, level); } }
public static void Log(Exception error, LogLevel severity = LogLevel.Error) { string caller = new StackTrace()?.GetFrame(1)?.GetMethod()?.ReflectedType?.FullName ?? Assembly.GetCallingAssembly().GetName().Name; if (log != null) { log.Log(severity, error); } else { Console.WriteLine($"[{Plugin.PluginName}] {severity.ToString().ToUpper()} {caller} - {error.Message}\n{error.StackTrace}"); } }
internal static void Log <T>(HashSet <T> messages, Level level = Level.Info) { foreach (T message in messages) { try { if (message is GameObject) { Log(message as GameObject, level); } else if (message is Component) { Log(message as Component, level); } else { Log(message, level); } } catch (Exception e) { Log(e, Level.Error); } } }
public static void Log(string m, LogLevel l, string suggestedAction) { var level = IPA.Logging.Logger.Level.Debug; switch (l) { case LogLevel.Debug: level = IPA.Logging.Logger.Level.Debug; break; case LogLevel.Notice: level = IPA.Logging.Logger.Level.Notice; break; case LogLevel.Warning: level = IPA.Logging.Logger.Level.Warning; break; case LogLevel.Error: level = IPA.Logging.Logger.Level.Error; break; case LogLevel.Critical: level = IPA.Logging.Logger.Level.Critical; break; } logger.Log(level, m); if (suggestedAction != null) { logger.Log(level, $"Suggested Action: {suggestedAction}"); } }
internal static void Log(string message, IPALogger.Level level) { log.Log(level, $"[BS-Utils] {message}"); }
internal static void Log(string message, LogLevel severity = LogLevel.Info) => log.Log(severity, message);
public LoggerTextWriter(IPALogger logger, IPALogger.Level level) { this.logger = logger; this.level = level; }
public static MarkdownPipelineBuilder WithLogger(this MarkdownPipelineBuilder pipeline, IPALogger logger, IPALogger.Level level = IPALogger.Level.Debug) => pipeline.WithDebugWriter(new LoggerTextWriter(logger, level));
public static void Log(string text, IPALogger.Level level = IPALogger.Level.Info, [CallerFilePath] string file = "", [CallerMemberName] string member = "", [CallerLineNumber] int line = 0) { Logger.log.Log(level, $"{Path.GetFileName(file)}->{member}({line}): {text}"); }
internal static void Log(string message, IPALogger.Level level = IPALogger.Level.Debug, [CallerMemberName] string member = "", [CallerLineNumber] int line = 0) { logger.Log(level, $"{member}({line}): {message}"); }
internal static void Log(string message = "<3", Level level = Level.Info) { logger.Log(level, message); }
internal static void Log(Exception e, IPALogger.Level level = IPALogger.Level.Error, [CallerMemberName] string member = "", [CallerLineNumber] int line = 0) { Log(e.ToString(), level); }
internal static void Log(object obj, IPALogger.Level level = IPALogger.Level.Debug, [CallerMemberName] string member = "", [CallerLineNumber] int line = 0) { Log(obj.ToString(), level, member, line); }
public static void Log(string m, LogLevel l) => Log(m, l, null);
internal static void Log(this object obj, IPALogger.Level level = IPALogger.Level.Info) => log.Log(level, obj.ToString());
internal static void Log(string message, IPALogger.Level level = IPALogger.Level.Debug) { log.Log(level, $"{message}"); }