C# Class Duality.Log

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

Méthodes publiques

Méthode 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

Méthode 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 méthode

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

Assembly() public static méthode

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
Résultat string

ConstructorInfo() public static méthode

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.
Résultat string

CurrentMethod() public static méthode

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.
Résultat string

CurrentStackFrame() public static méthode

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.
Résultat System.Diagnostics.StackFrame

CurrentType() public static méthode

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.
Résultat string

EventInfo() public static méthode

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.
Résultat string

Exception() public static méthode

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
Résultat string

FieldInfo() public static méthode

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.
Résultat string

Log() public méthode

Creates a new Log.
public Log ( string name ) : System
name string The Logs name
Résultat System

Log() public méthode

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.
Résultat System

MemberInfo() public static méthode

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.
Résultat string

MethodInfo() public static méthode

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.
Résultat string

MethodInfo() public static méthode

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.
Résultat string

PopIndent() public méthode

Decreases the current log entry indent.
public PopIndent ( ) : void
Résultat void

PropertyInfo() public static méthode

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.
Résultat string

PushIndent() public méthode

Increases the current log entry indent.
public PushIndent ( ) : void
Résultat void

RemoveOutput() public méthode

Removes a certain output.
public RemoveOutput ( ILogOutput writer ) : void
writer ILogOutput
Résultat void

Type() public static méthode

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

Write() public méthode

Writes a new log entry.
public Write ( string format ) : void
format string
Résultat void

WriteError() public méthode

Writes a new error log entry.
public WriteError ( string format ) : void
format string
Résultat void

WriteWarning() public méthode

Writes a new warning log entry.
public WriteWarning ( string format ) : void
format string
Résultat void