Esempio n. 1
0
 public Task Log(object message, SimpleLogLevel level)
 {
     if (this.ShouldLog(level))
     {
         var args = LogMessageArgs.Create(Category, message, level);
         LogActions.Invoke(args);
     }
     return(0.AsTask());
 }
Esempio n. 2
0
        public void Invoke(LogMessageArgs args)
        {
            //todo result cache?
            var logMessageActions = this.Values.Where(x => x.Enabled).ToList();

            foreach (var logMessageAction in logMessageActions)
            {
                logMessageAction.Action(args);
            }
        }
Esempio n. 3
0
 private static void LogMessage(LogMessageArgs args)
 {
     if (_prefix == null)
     {
         _prefix = string.IsNullOrWhiteSpace(SimpleLogSettings.DefaultPrefix)
             ? string.Empty
             : string.Format("[{0}]", SimpleLogSettings.DefaultPrefix.Trim());
     }
     Trace.WriteLine(string.Format("{0} [{1}][{2}]{3} {4}", args.Category, "SimpleLog", args.Level.ToString(), _prefix, args.Message));
 }
Esempio n. 4
0
 public void Log(LogMessageArgs args)
 {
     Invoked = true;
 }
Esempio n. 5
0
 private static void LogMessage(LogMessageArgs args)
 {
     Trace.WriteLine(string.Format("{0} [{1}][{2}] {3}", args.Category, "SimpleLog", args.Level.ToString(), args.Message));
 }