Example #1
0
        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}");
            }
        }
Example #2
0
 internal static void Log(GameObject message, Level level = Level.Info)
 {
     try {
         Log(message.GetFullPath(), level);
     } catch (Exception e) {
         Log(e, Level.Error);
     }
 }
Example #3
0
 internal static void Log(object message, Level level = Level.Info)
 {
     try {
         Log(message.ToString(), level);
     } catch (Exception e) {
         Log(e, Level.Error);
     }
 }
Example #4
0
 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}");
            }
        }
Example #6
0
 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);
         }
     }
 }
Example #7
0
        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}");
            }
        }
Example #8
0
 internal static void Log(string message, IPALogger.Level level)
 {
     log.Log(level, $"[BS-Utils]  {message}");
 }
Example #9
0
 internal static void Log(string message, LogLevel severity = LogLevel.Info) => log.Log(severity, message);
Example #10
0
 public LoggerTextWriter(IPALogger logger, IPALogger.Level level)
 {
     this.logger = logger;
     this.level  = level;
 }
Example #11
0
 public static MarkdownPipelineBuilder WithLogger(this MarkdownPipelineBuilder pipeline, IPALogger logger, IPALogger.Level level = IPALogger.Level.Debug)
 => pipeline.WithDebugWriter(new LoggerTextWriter(logger, level));
Example #12
0
 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}");
 }
Example #13
0
 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}");
 }
Example #14
0
 internal static void Log(string message = "<3", Level level = Level.Info)
 {
     logger.Log(level, message);
 }
Example #15
0
 internal static void Log(Exception e, IPALogger.Level level = IPALogger.Level.Error,
                          [CallerMemberName] string member   = "",
                          [CallerLineNumber] int line        = 0)
 {
     Log(e.ToString(), level);
 }
Example #16
0
 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);
 }
Example #17
0
 public static void Log(string m, LogLevel l) => Log(m, l, null);
Example #18
0
 internal static void Log(this object obj, IPALogger.Level level = IPALogger.Level.Info) => log.Log(level, obj.ToString());
Example #19
0
 internal static void Log(string message, IPALogger.Level level = IPALogger.Level.Debug)
 {
     log.Log(level, $"{message}");
 }