public void Log(ILoggerMessage message) { Task.Run(() => { Logs sqlLogMessage = new Logs { Error = message.IsError, Message = message.GetMessage(), Source = message.GetSource(), TimeOfCreation = message.GetTimeOfCreation(), Class = message.GetClassName() }; using (Context con = new Context(config)) { con.Logs.Add(sqlLogMessage); con.SaveChanges(); } }); }
public void Log(ILoggerMessage message) { String theText = String.Format("{0}; {1}; {2}: {3}\n", message.GetTimeOfCreation().ToLongTimeString(), message.GetSource(), message.GetClassName(), message.GetMessage()); if (message.IsError) { Console.Error.Write(theText); } else { Console.Out.Write(theText); } }
public void Log(ILoggerMessage message) { String theText = String.Format("{0}; {1}; {2}: {3}\n", message.GetTimeOfCreation().ToLongTimeString(), message.GetSource(), message.GetClassName(), message.GetMessage()); System.Diagnostics.Debug.Write(theText); }