Example #1
0
 private void log(string str, Logging.Level level)
 {
     if (LoggingLevel <= level)
     {
         Logger.log(str, level);
     }
 }
Example #2
0
 public static void LogFormat(Logging.Category category, string format, Logging.Level level = Logging.Level.LOG, params object[] args)
 {
     if (Self != null && Self._logging != null)
     {
         Self._logging.LogFormat(category, format, level, args);
     }
 }
Example #3
0
 //public static access (static global-access systems like logging, databases, etc...)
 public static void Log(Logging.Category category, string message, Logging.Level level = Logging.Level.LOG)
 {
     if (Self != null && Self._logging != null)
     {
         Self._logging.Log(category, message, level);
     }
 }
Example #4
0
        public void logWithStackTrace(string text, Logging.Level level)
        {
            var sb = new StringBuilder(128);

            sb.AppendLine(text);
            Logging.GetStackTraceString(new StackTrace(1), sb);
            sb.AppendLine();
            log(sb.ToString(), level);
        }
Example #5
0
        public virtual void log(string text, Logging.Level level)
        {
#if !DEBUG
            if (level < Logging.Level.Warning)
            {
                return;
            }
#endif
            Logger.log(text, level);
        }
Example #6
0
 public void exception(Exception ex, Logging.Level level = Logging.Level.None, string text = null)
 {
     try {
         if (ex == null)
         {
             log(text + " (Exception object is null!!!)\r\nStackTrace:\r\n" + new StackTrace(true).ToString(), level);
         }
         else
         {
             log(Logging.getExceptionText(ex, text), level);
         }
     } catch (Exception) { }
 }
Example #7
0
 public void log(string text, Logging.Level level)
 {
     if (isNullLogger)
     {
         return;
     }
     log(new Logging.Log {
         text        = ResultingStamp.IsNullOrEmpty() ? text : "<" + ResultingStamp + ">: " + text,
         level       = level,
         runningTime = Logging.Runtime,
         time        = DateTime.Now
     });
 }
Example #8
0
        private static Color?getColorFromLevel(Logging.Level level)
        {
            switch (level)
            {
            case Logging.Level.None:
            case Logging.Level.Debug:
                return(Color.Argb(40, 0, 0, 0));

            case Logging.Level.Info:
                return(Color.Argb(60, 0, 255, 0));

            case Logging.Level.Warning:
                return(Color.Argb(80, 255, 255, 0));

            case Logging.Level.Error:
            default:
                return(Color.Argb(50, 255, 0, 0));
            }
        }
Example #9
0
 public virtual void logException(Exception ex, Logging.Level level, string text)
 {
     Logger.exception(ex, level, text);
 }
Example #10
0
 public virtual void log(string text, Logging.Level level)
 {
     server.log($"(#{Id}|{remoteEP}({RequestCount})) {text}", level);
 }
Example #11
0
        /// <summary>
        /// Checks if the given section/setting combination exists in this configuration.
        /// </summary>
        /// <param name="config"></param>
        /// <param name="section"></param>
        /// <param name="key"></param>
        /// <param name="loggingLevel"></param>
        /// <returns></returns>
        public static bool Exists(this SharpConfig.Configuration config, string section, string key, Logging.Level loggingLevel = Logging.Level.Error)
        {
            var exists = config.Contains(section) && config[section].Contains(key);

            if (!exists)
            {
                Logging.Log(config, "Could not find [" + section + "] [" + key + "]", Logging.Level.Warning, loggingLevel);
            }

            return(exists);
        }