18 using System.Globalization;
20 namespace Deveel.Data.Diagnostics {
33 var logMessage = FormatMessage(message);
34 LogMessage(logMessage);
38 var format = Settings.MessageFormat;
39 foreach (var key
in entry.Keys) {
40 var value = FormatValue(entry.GetValue(key));
41 var holder = String.Format(
"{0}", key);
43 format = format.Replace(holder, value);
54 return (
string) value;
55 if (value is DateTime ||
56 value is DateTimeOffset) {
57 if (String.IsNullOrEmpty(Settings.DateFormat))
58 return value.ToString();
60 if (value is DateTimeOffset)
61 return ((DateTimeOffset) value).ToString(Settings.DateFormat);
63 return ((DateTime) value).ToString(Settings.DateFormat);
66 if (!(value is IConvertible))
69 return (
string) Convert.ChangeType(value, typeof (
string), CultureInfo.InvariantCulture);
72 protected abstract void LogMessage(
string message);
string FormatValue(object value)
LoggerBase(LoggerSettings settings)
override void Consume(LogEntry message)
string FormatMessage(LogEntry entry)