void Write(LogLevel level, string message, object[] objs) { if ((int)level < (int)factory.MinLevel) { return; } if (factory.AbortedByFilter(new LogStatement { Level = level, Text = message, Args = objs })) { return; } var levelString = LevelString(level); var threadName = Thread.CurrentThread.Name; var typeName = type.FullName; try { Console.WriteLine(logLineFormatString, DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), typeName, levelString, threadName, string.Format(message, objs)); } catch { Warn("Could not render output string: {0}", message); } }
void Write(LogLevel level, string message, object[] objs) { if ((int)level < (int)factory.MinLevel) { return; } if (factory.AbortedByFilter(new LogStatement { Level = level, Text = message, Args = objs })) { return; } var levelString = LevelString(level); try { Console.WriteLine("{0} {1} ({2}): {3}", type.FullName, levelString, Thread.CurrentThread.Name, string.Format(message, objs)); } catch { Warn("Could not render output string: {0}", message); Console.WriteLine("{0} {1} ({2}): {3}", type.FullName, levelString, Thread.CurrentThread.Name, message); } }
void Write(LogLevel level, string message, object[] objs) { if ((int)level < (int)_factory.MinLevel) { return; } if (_factory.AbortedByFilter(new LogStatement(level, message, objs, _type))) { return; } var levelString = LevelString(level); var threadName = GetThreadName(); var typeName = _type.FullName; try { var renderedMessage = string.Format(message, objs); var timeFormat = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); // ReSharper disable EmptyGeneralCatchClause try { Console.WriteLine(_logLineFormatString, timeFormat, typeName, levelString, threadName, renderedMessage); } catch { // nothing to do about it if this part fails } // ReSharper restore EmptyGeneralCatchClause } catch { Warn("Could not render output string: '{0}' with args: {1}", message, string.Join(", ", objs)); } }
void Write(LogLevel level, string message, object[] objs) { if ((int)level < (int)factory.MinLevel) { return; } if (factory.AbortedByFilter(new LogStatement { Level = level, Text = message, Args = objs })) { return; } var levelString = LevelString(level); var threadName = Thread.CurrentThread.Name; var typeName = type.FullName; try { var renderedMessage = string.Format(message, objs); var timeFormat = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); try { Console.WriteLine(logLineFormatString, timeFormat, typeName, levelString, threadName, renderedMessage); } catch { } //< nothing to do about it if this part fails } catch { Warn("Could not render output string: '{0}' with args: {1}", message, string.Join(", ", objs)); } }