Enhanced C#
Language of your choice: library documentation
Properties | Public Member Functions | List of all members
Loyc.MessageFilter Class Reference

A decorator that uses a delegate to accept or ignore messages. More...


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

Remarks

A decorator that uses a delegate to accept or ignore messages.

The filter can accept or reject messages based on both the message type and the actual message (format string). When someone calls IsEnabled(Severity), the filter is invoked with only the type; the message is set to null. Accepted messages are sent to the Target message sink.

Properties

Func< Severity, object, string, bool > Filter [get, set]
 
Func< Severity, bool > TypeFilter [get, set]
 
IMessageSink Target [get, set]
 

Public Member Functions

 MessageFilter (IMessageSink target, Func< Severity, object, string, bool > filter)
 
 MessageFilter (IMessageSink target, Func< Severity, bool > filter)
 
void Write (Severity level, object context, string format)
 
void Write (Severity level, object context, string format, object arg0, object arg1=null)
 
void Write (Severity level, object context, string format, params object[] args)
 
bool IsEnabled (Severity level)
 Returns true if Filter(type, null) and target.IsEnabled(type) are both true. More...
 
- Public Member Functions inherited from Loyc.IMessageSink< in in 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)
 

Member Function Documentation

◆ IsEnabled()

bool Loyc.MessageFilter.IsEnabled ( Severity  level)
inline

Returns true if Filter(type, null) and target.IsEnabled(type) are both true.

Implements Loyc.IMessageSink< in in TContext >.

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