C# Class Duality.Log

Listens for log entries and writes them to registered ILogOutputs.
Mostrar archivo Open project: BraveSirAndrew/duality Class Usage Examples

Public Methods

Method Description
AddOutput ( ILogOutput writer ) : void

Adds an output to write log entries to.

Assembly ( Assembly asm ) : string

Returns a string that can be used for representing a System.Reflection.Assembly in log entries.

ConstructorInfo ( ConstructorInfo info, bool includeDeclaringType = true ) : string

Returns a string that can be used for representing a constructor in log entries.

CurrentMethod ( int skipFrames, bool includeDeclaringType = true ) : string

Returns the name of the caller method.

CurrentStackFrame ( int skipFrames ) : System.Diagnostics.StackFrame

Retrieves the current stack frame.

CurrentType ( int skipFrames ) : string

Returns the name of the caller methods declaring type.

EventInfo ( EventInfo info, bool includeDeclaringType = true ) : string

Returns a string that can be used for representing an event in log entries.

Exception ( Exception e, bool callStack = true ) : string

Returns a string that can be used for representing an exception in log entries. It usually does not include the full call stack and is significantly shorter than an Exceptions ToString method.

FieldInfo ( FieldInfo info, bool includeDeclaringType = true ) : string

Returns a string that can be used for representing a field in log entries.

Log ( string name ) : System

Creates a new Log.

Log ( string name, SharedState stateHolder ) : System

Creates a new Log.

MemberInfo ( MemberInfo info, bool includeDeclaringType = true ) : string

Returns a string that can be used for representing a(ny) member in log entries.

MethodInfo ( MethodBase info, bool includeDeclaringType = true ) : string

Returns a string that can be used for representing a method or constructor in log entries.

MethodInfo ( MethodInfo info, bool includeDeclaringType = true ) : string

Returns a string that can be used for representing a method in log entries.

PopIndent ( ) : void

Decreases the current log entry indent.

PropertyInfo ( PropertyInfo info, bool includeDeclaringType = true ) : string

Returns a string that can be used for representing a property in log entries.

PushIndent ( ) : void

Increases the current log entry indent.

RemoveOutput ( ILogOutput writer ) : void

Removes a certain output.

Type ( Type type ) : string

Returns a string that can be used for representing a System.Type in log entries.

Write ( string format ) : void

Writes a new log entry.

WriteError ( string format ) : void

Writes a new error log entry.

WriteWarning ( string format ) : void

Writes a new warning log entry.

Private Methods

Method Description
FindContext ( object obj ) : object
FormatMessage ( string format, object obj ) : string
Log ( ) : System
Write ( LogMessageType type, string format, object context ) : void

Method Details

AddOutput() public method

Adds an output to write log entries to.
public AddOutput ( ILogOutput writer ) : void
writer ILogOutput
return void

Assembly() public static method

Returns a string that can be used for representing a System.Reflection.Assembly in log entries.
public static Assembly ( Assembly asm ) : string
asm System.Reflection.Assembly
return string

ConstructorInfo() public static method

Returns a string that can be used for representing a constructor in log entries.
public static ConstructorInfo ( ConstructorInfo info, bool includeDeclaringType = true ) : string
info System.Reflection.ConstructorInfo
includeDeclaringType bool If true, the constructors declaring type is included in the returned name.
return string

CurrentMethod() public static method

Returns the name of the caller method.
public static CurrentMethod ( int skipFrames, bool includeDeclaringType = true ) : string
skipFrames int The number of frames to skip. This function itsself is omitted by default.
includeDeclaringType bool If true, the methods declaring type is included in the returned name.
return string

CurrentStackFrame() public static method

Retrieves the current stack frame.
public static CurrentStackFrame ( int skipFrames ) : System.Diagnostics.StackFrame
skipFrames int The number of frames to skip. This function itsself is omitted by default.
return System.Diagnostics.StackFrame

CurrentType() public static method

Returns the name of the caller methods declaring type.
public static CurrentType ( int skipFrames ) : string
skipFrames int The number of frames to skip. This function itsself is omitted by default.
return string

EventInfo() public static method

Returns a string that can be used for representing an event in log entries.
public static EventInfo ( EventInfo info, bool includeDeclaringType = true ) : string
info System.Reflection.EventInfo
includeDeclaringType bool If true, the events declaring type is included in the returned name.
return string

Exception() public static method

Returns a string that can be used for representing an exception in log entries. It usually does not include the full call stack and is significantly shorter than an Exceptions ToString method.
public static Exception ( Exception e, bool callStack = true ) : string
e System.Exception
callStack bool
return string

FieldInfo() public static method

Returns a string that can be used for representing a field in log entries.
public static FieldInfo ( FieldInfo info, bool includeDeclaringType = true ) : string
info System.Reflection.FieldInfo
includeDeclaringType bool If true, the fields declaring type is included in the returned name.
return string

Log() public method

Creates a new Log.
public Log ( string name ) : System
name string The Logs name
return System

Log() public method

Creates a new Log.
public Log ( string name, SharedState stateHolder ) : System
name string The Logs name.
stateHolder SharedState The Logs state value holder that may be shared with other Logs.
return System

MemberInfo() public static method

Returns a string that can be used for representing a(ny) member in log entries.
public static MemberInfo ( MemberInfo info, bool includeDeclaringType = true ) : string
info System.Reflection.MemberInfo
includeDeclaringType bool If true, the members declaring type is included in the returned name.
return string

MethodInfo() public static method

Returns a string that can be used for representing a method or constructor in log entries.
public static MethodInfo ( MethodBase info, bool includeDeclaringType = true ) : string
info System.Reflection.MethodBase
includeDeclaringType bool If true, the methods or constructors declaring type is included in the returned name.
return string

MethodInfo() public static method

Returns a string that can be used for representing a method in log entries.
public static MethodInfo ( MethodInfo info, bool includeDeclaringType = true ) : string
info System.Reflection.MethodInfo
includeDeclaringType bool If true, the methods declaring type is included in the returned name.
return string

PopIndent() public method

Decreases the current log entry indent.
public PopIndent ( ) : void
return void

PropertyInfo() public static method

Returns a string that can be used for representing a property in log entries.
public static PropertyInfo ( PropertyInfo info, bool includeDeclaringType = true ) : string
info System.Reflection.PropertyInfo
includeDeclaringType bool If true, the properties declaring type is included in the returned name.
return string

PushIndent() public method

Increases the current log entry indent.
public PushIndent ( ) : void
return void

RemoveOutput() public method

Removes a certain output.
public RemoveOutput ( ILogOutput writer ) : void
writer ILogOutput
return void

Type() public static method

Returns a string that can be used for representing a System.Type in log entries.
public static Type ( Type type ) : string
type System.Type
return string

Write() public method

Writes a new log entry.
public Write ( string format ) : void
format string
return void

WriteError() public method

Writes a new error log entry.
public WriteError ( string format ) : void
format string
return void

WriteWarning() public method

Writes a new warning log entry.
public WriteWarning ( string format ) : void
format string
return void