Enhanced C#
Language of your choice: library documentation
Properties | Public Member Functions | List of all members
Loyc.SeverityMessageFilter< TContext > Class Template Reference

A decorator (wrapper) for IMessageSink that filters out some messages if their Severity is too low, according to the value of the MinSeverity property. More...


Source file:
Inheritance diagram for Loyc.SeverityMessageFilter< TContext >:
Loyc.IMessageSink< TContext > Loyc.IMessageSink< in in TContext >

Remarks

A decorator (wrapper) for IMessageSink that filters out some messages if their Severity is too low, according to the value of the MinSeverity property.

Alias for SeverityMessageFilter<object>.

Properties

IMessageSink< TContext > Target [get, set]
 
Severity MinSeverity [get, set]
 Gets or sets the minimum severity that passes the filter. Note: usually this property should be set to a detail level such as Severity.InfoDetail rather than a "normal" level such as Severity.Info, which is one higher. More...
 

Public Member Functions

 SeverityMessageFilter (IMessageSink< TContext > target, Severity minSeverity, bool includeDetails=true)
 Initializes the filter with a minimum severity. More...
 
void Write (Severity level, TContext context, string format)
 Writes a message to the target that this object represents. More...
 
void Write (Severity level, TContext context, string format, object arg0, object arg1=null)
 
void Write (Severity level, TContext context, string format, params object[] args)
 
bool IsEnabled (Severity level)
 Returns true if messages of the specified type will actually be printed, or false if Write(type, ...) has no effect. More...
 
 SeverityMessageFilter (IMessageSink< object > target, Severity minSeverity, bool includeDetails=true)
 
- Public Member Functions inherited from Loyc.IMessageSink< TContext >
void Write (Severity level, TContext context,[Localizable] string format)
 Writes a message to the target that this object represents. More...
 
void Write (Severity level, TContext context,[Localizable] string format, object arg0, object arg1=null)
 
void Write (Severity level, TContext context,[Localizable] string format, params object[] args)
 
bool IsEnabled (Severity level)
 Returns true if messages of the specified type will actually be printed, or false if Write(type, ...) has no effect. More...
 

Constructor & Destructor Documentation

Loyc.SeverityMessageFilter< TContext >.SeverityMessageFilter ( IMessageSink< TContext >  target,
Severity  minSeverity,
bool  includeDetails = true 
)
inline

Initializes the filter with a minimum severity.

Parameters
targetAnother sink to which all messages will be written that pass this filter.
minSeverityMinimum severity for which IsEnabled returns true, possibly modified by includeDetails.
includeDetailsCauses minSeverity to be reduced by one if minSeverity is an even number. Often when one uses a severity like Severity.Warning, one actually intends to also include any associated Severity.WarningDetail messages. This parameter ensures that you do not exclude details accidentally by changing minSeverity for you. To disable this behavior, set this parameter to false.

References Loyc.SeverityMessageFilter< TContext >.MinSeverity.

Member Function Documentation

bool Loyc.SeverityMessageFilter< TContext >.IsEnabled ( Severity  level)
inline

Returns true if messages of the specified type will actually be printed, or false if Write(type, ...) has no effect.

Implements Loyc.IMessageSink< in in TContext >.

References Loyc.IMessageSink< in in TContext >.IsEnabled().

Referenced by Loyc.MessageSinkWithContext< TContext >.MessageSinkWithContext(), and Loyc.MessageSinkWithContext< TContext >.Write().

void Loyc.SeverityMessageFilter< TContext >.Write ( Severity  level,
TContext  context,
string  format 
)
inline

Writes a message to the target that this object represents.

Parameters
levelSeverity or importance of the message; widely-used types include Error, Warning, Note, Debug, and Verbose. The special type Detail is intended to provide more information about a previous message.
contextAn object that the message is related to, or that represents the location that the message applies to. The message sink may try to convert this object to a string and include it in its output. See also MessageSink.ContextToString().
formatA message to display. If there are additional arguments, placeholders such as {0} and {1} refer to these arguments.

Implements Loyc.IMessageSink< in in TContext >.

References Loyc.IMessageSink< in in TContext >.Write().

Referenced by Loyc.MessageMulticaster< TContext >.Write(), and Loyc.MessageSinkWithContext< TContext >.Write().

Property Documentation

Severity Loyc.SeverityMessageFilter< TContext >.MinSeverity
getset

Gets or sets the minimum severity that passes the filter. Note: usually this property should be set to a detail level such as Severity.InfoDetail rather than a "normal" level such as Severity.Info, which is one higher.

Referenced by Loyc.SeverityMessageFilter< TContext >.SeverityMessageFilter().