Table of Contents

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 string

The 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 string

The name for the instance.

traceListeners IEnumerable<TraceListener>

The collection of TraceListeners.

level SourceLevels

The 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 string

The name for the instance.

traceListeners IEnumerable<TraceListener>

The collection of TraceListeners.

level SourceLevels

The SourceLevels value.

autoFlush bool

If 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 string

The name for the instance.

level SourceLevels

The SourceLevels value.

Fields

DefaultAutoFlushProperty

Default Auto Flush property for the LogSource instance.

public const bool DefaultAutoFlushProperty = true

Field Value

bool

Properties

AutoFlush

Gets or sets the AutoFlush values for the LogSource instance.

public bool AutoFlush { get; set; }

Property Value

bool

Level

Gets or sets the SourceLevels values at which to trace for the LogSource instance.

public SourceLevels Level { get; set; }

Property Value

SourceLevels

Listeners

Gets the collection of trace listeners for the LogSource instance.

public IEnumerable<TraceListener> Listeners { get; }

Property Value

IEnumerable<TraceListener>

Name

Gets the name for the LogSource instance.

public string Name { get; }

Property Value

string

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 TraceEventType

The value that specifies the type of event that caused the trace.

id int

A numeric identifier for the event.

logEntry LogEntry

The 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 TraceEventType

The value that specifies the type of event that caused the trace.

id int

A numeric identifier for the event.

logEntry LogEntry

The LogEntry to trace.

traceListenerFilter TraceListenerFilter

The 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.