Enhanced C#
Loyc library documentation
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
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

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

Member Function Documentation

bool Loyc.MessageFilter.IsEnabled ( Severity  level)
inline

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