Class LogSource
- Namespace
- Microsoft.Practices.EnterpriseLibrary.Logging
- Assembly
- Microsoft.Practices.EnterpriseLibrary.Logging.dll
Provides tracing services through a set of TraceListeners.
public class LogSource
- Inheritance
-
LogSource
- Inherited Members
Constructors
LogSource(string)
Initializes a new instance of the LogSource class with a name.
public LogSource(string name)
Parameters
name
stringThe name for the instance.
LogSource(string, IEnumerable<TraceListener>, SourceLevels)
Initializes a new instance of the LogSource class with a name, a collection of TraceListeners and a level.
public LogSource(string name, IEnumerable<TraceListener> traceListeners, SourceLevels level)
Parameters
name
stringThe name for the instance.
traceListeners
IEnumerable<TraceListener>The collection of TraceListeners.
level
SourceLevelsThe SourceLevels value.
LogSource(string, IEnumerable<TraceListener>, SourceLevels, bool)
Initializes a new instance of the LogSource class with a name, a collection of TraceListeners, a level and the auto flush.
public LogSource(string name, IEnumerable<TraceListener> traceListeners, SourceLevels level, bool autoFlush)
Parameters
name
stringThe name for the instance.
traceListeners
IEnumerable<TraceListener>The collection of TraceListeners.
level
SourceLevelsThe SourceLevels value.
autoFlush
boolIf Flush should be called on the Listeners after every write.
LogSource(string, SourceLevels)
Initializes a new instance of the LogSource class with a name and a level.
public LogSource(string name, SourceLevels level)
Parameters
name
stringThe name for the instance.
level
SourceLevelsThe SourceLevels value.
Fields
DefaultAutoFlushProperty
Default Auto Flush property for the LogSource instance.
public const bool DefaultAutoFlushProperty = true
Field Value
Properties
AutoFlush
public bool AutoFlush { get; set; }
Property Value
Level
Gets or sets the SourceLevels values at which to trace for the LogSource instance.
public SourceLevels Level { get; set; }
Property Value
Listeners
Gets the collection of trace listeners for the LogSource instance.
public IEnumerable<TraceListener> Listeners { get; }
Property Value
Name
Gets the name for the LogSource instance.
public string Name { get; }
Property Value
Methods
TraceData(TraceEventType, int, LogEntry)
Writes trace data to the trace listeners in the Listeners collection using the specified event type, event identifier, and trace data.
public void TraceData(TraceEventType eventType, int id, LogEntry logEntry)
Parameters
eventType
TraceEventTypeThe value that specifies the type of event that caused the trace.
id
intA numeric identifier for the event.
logEntry
LogEntryThe LogEntry to trace.
TraceData(TraceEventType, int, LogEntry, TraceListenerFilter)
Writes trace data to the trace listeners in the Listeners collection that have not already been written to for tracing using the specified event type, event identifier, and trace data.
public void TraceData(TraceEventType eventType, int id, LogEntry logEntry, TraceListenerFilter traceListenerFilter)
Parameters
eventType
TraceEventTypeThe value that specifies the type of event that caused the trace.
id
intA numeric identifier for the event.
logEntry
LogEntryThe LogEntry to trace.
traceListenerFilter
TraceListenerFilterThe filter for already written to trace listeners.
Remarks
The traceListenerFilter
will be updated to reflect the trace listeners that were written to by the
LogSource.