public Task Log(object message, SimpleLogLevel level) { if (this.ShouldLog(level)) { var args = LogMessageArgs.Create(Category, message, level); LogActions.Invoke(args); } return(0.AsTask()); }
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); } }
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)); }
public void Log(LogMessageArgs args) { Invoked = true; }
private static void LogMessage(LogMessageArgs args) { Trace.WriteLine(string.Format("{0} [{1}][{2}] {3}", args.Category, "SimpleLog", args.Level.ToString(), args.Message)); }