private static void LogMore(CommonLogger logger) { Stopwatch sw = Stopwatch.StartNew(); logger.LogDebug(typeof(Program), "with MORE"); sw.Stop(); logger.LogInfo(typeof(Program), "How much time to log", "", null, sw.Elapsed); }
private static void LogMore(CommonLogger logger) { IDictionary <string, object> logPairs = new Dictionary <string, object>() { { "Custom1", 123245 } }; Stopwatch sw = Stopwatch.StartNew(); logger.LogWarning(typeof(Program), "with MORE", "LM", logPairs, null, null); sw.Stop(); logger.LogInfo(typeof(Program), "How much time to log", "LM", null, sw.Elapsed); }
static void Main(string[] args) { Stopwatch sw = Stopwatch.StartNew(); CommonLogger logger = new CommonLogger(); logger.LogDataPublish += (sender, logData) => { WriteTheLogEntry(logData); }; sw.Stop(); logger.LogDebug(typeof(Program), "Logging test in .Net Core"); logger.LogInfo(typeof(Program), "Some Info to be logged"); LogMore(logger); LogWithException(logger); var val = (short)logger.AllowedLogLevels; LogLevels test = (LogLevels)val; Console.ReadKey(); logger.Dispose(); }