private void Append(string level, string format, params object[] values) { DateTime DT = DateTime.Now; format = TryGetPredefinedMessage(format); string formattedMessage; try { formattedMessage = string.Format(format, values); } catch (FormatException e) { formattedMessage = format + " [BMYLOG4PB FATAL]: " + e.Message; } var message = new BMyMessage( DT.ToShortDateString(), DT.ToLongTimeString(), DT.Millisecond.ToString(), level, Assembly.Runtime.CurrentInstructionCount, Assembly.Runtime.MaxInstructionCount, formattedMessage, StackToString(), Assembly.Me.CustomName ); foreach (var item in Appenders) { var formatBuffer = (item.Value != null) ? item.Value : _defaultFormat; item.Key.Enqueue(message.ToString(formatBuffer)); if (AutoFlush) { item.Key.Flush(); } } }
private void Append(string level, string format, params object[] values) { DateTime DT = DateTime.Now; var message = new BMyMessage( DT.ToShortDateString(), DT.ToLongTimeString(), DT.Millisecond.ToString(), level, Assembly.Runtime.CurrentInstructionCount, Assembly.Runtime.MaxInstructionCount, string.Format(format, values), StackToString() ); foreach (var item in Appenders) { var formatBuffer = (item.Value != null) ? item.Value : _defaultFormat; item.Key.Enqueue(message.ToString(formatBuffer)); if (AutoFlush) { item.Key.Flush(); } } }