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

This helper class lets you implement IMessageSink with one or two delegates (a writer method, and an optional severity filter). More...


Source file:
Inheritance diagram for Loyc.MessageSinkFromDelegate:
Loyc.IMessageSink< in in TSeverity, in in TContext >

Remarks

This helper class lets you implement IMessageSink with one or two delegates (a writer method, and an optional severity filter).

Public Member Functions

 MessageSinkFromDelegate (WriteMessageFn writer, Func< Severity, bool > isEnabled=null)
 Initializes this object. More...
 
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)
 

Constructor & Destructor Documentation

Loyc.MessageSinkFromDelegate.MessageSinkFromDelegate ( WriteMessageFn  writer,
Func< Severity, bool >  isEnabled = null 
)
inline

Initializes this object.

Parameters
writerRequired. A method that accepts output.
isEnabledOptional. A method that decides whether to output based on the message type. If this parameter is provided, then Write() will not invoke the writer when isEnabled returns false. This delegate is also called by IsEnabled().

References Loyc.ConsoleMessageSink.IsEnabled().