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

Member Function Documentation

bool Loyc.MessageFilter.IsEnabled ( Severity  type)
inline

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