DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Protected Member Functions | Properties | Private Member Functions | List of all members
Deveel.Data.Diagnostics.LoggerBase Class Referenceabstract
Inheritance diagram for Deveel.Data.Diagnostics.LoggerBase:
Deveel.Data.Diagnostics.ThreadedQueue< LogEntry >

Protected Member Functions

 LoggerBase (LoggerSettings settings)
 
override void Consume (LogEntry message)
 
abstract void LogMessage (string message)
 
- Protected Member Functions inherited from Deveel.Data.Diagnostics.ThreadedQueue< LogEntry >
 ThreadedQueue ()
 
abstract void Consume (TMessage message)
 
void Enqueue (TMessage message)
 
virtual void Dispose (bool disposing)
 

Properties

LoggerSettings Settings [get, private set]
 
- Properties inherited from Deveel.Data.Diagnostics.ThreadedQueue< LogEntry >
virtual int ThreadCount [get]
 

Private Member Functions

 ~LoggerBase ()
 
string FormatMessage (LogEntry entry)
 
string FormatValue (object value)
 

Additional Inherited Members

- Public Member Functions inherited from Deveel.Data.Diagnostics.ThreadedQueue< LogEntry >
void Dispose ()
 
- Public Attributes inherited from Deveel.Data.Diagnostics.ThreadedQueue< LogEntry >
const int DefaultThreadCount
 

Detailed Description

Definition at line 21 of file LoggerBase.cs.

Constructor & Destructor Documentation

Deveel.Data.Diagnostics.LoggerBase.LoggerBase ( LoggerSettings  settings)
inlineprotected

Definition at line 22 of file LoggerBase.cs.

22  {
23  Settings = settings;
24  }
Deveel.Data.Diagnostics.LoggerBase.~LoggerBase ( )
inlineprivate

Definition at line 26 of file LoggerBase.cs.

Member Function Documentation

override void Deveel.Data.Diagnostics.LoggerBase.Consume ( LogEntry  message)
inlineprotected

Definition at line 32 of file LoggerBase.cs.

32  {
33  var logMessage = FormatMessage(message);
34  LogMessage(logMessage);
35  }
abstract void LogMessage(string message)
string FormatMessage(LogEntry entry)
Definition: LoggerBase.cs:37
string Deveel.Data.Diagnostics.LoggerBase.FormatMessage ( LogEntry  entry)
inlineprivate

Definition at line 37 of file LoggerBase.cs.

37  {
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);
42 
43  format = format.Replace(holder, value);
44  }
45 
46  return format;
47  }
A long string in the system.
string FormatValue(object value)
Definition: LoggerBase.cs:49
string Deveel.Data.Diagnostics.LoggerBase.FormatValue ( object  value)
inlineprivate

Definition at line 49 of file LoggerBase.cs.

49  {
50  if (value == null)
51  return String.Empty;
52 
53  if (value is string)
54  return (string) value;
55  if (value is DateTime ||
56  value is DateTimeOffset) {
57  if (String.IsNullOrEmpty(Settings.DateFormat))
58  return value.ToString();
59 
60  if (value is DateTimeOffset)
61  return ((DateTimeOffset) value).ToString(Settings.DateFormat);
62 
63  return ((DateTime) value).ToString(Settings.DateFormat);
64  }
65 
66  if (!(value is IConvertible))
67  return String.Empty;
68 
69  return (string) Convert.ChangeType(value, typeof (string), CultureInfo.InvariantCulture);
70  }
A long string in the system.
abstract void Deveel.Data.Diagnostics.LoggerBase.LogMessage ( string  message)
protectedpure virtual

Property Documentation

LoggerSettings Deveel.Data.Diagnostics.LoggerBase.Settings
getprivate set

Definition at line 30 of file LoggerBase.cs.


The documentation for this class was generated from the following file: