C# Class Endjin.Assembly.ChangeDetection.Infrastructure.Tracer

High performance tracer class which enables method enter/leave tracing with duration and other features.
Datei anzeigen Open project: endjin/Endjin.Assembly.ChangeDetection Class Usage Examples

Private Properties

Property Type Description
ClearEvents void
FormatDuration string
FormatStringSafe string
FormatTime string
GenerateTypeMethodName string
Instrument void
Instrument void
Instrument void
TraceMsg void

Public Methods

Method Description
Dispose ( ) : void

Generate a leaving method trace. Normally called at the end of an using statement.

When the method is left with an exception and Exception tracing is enabled it will trace this exception.

Error ( Exception ex ) : void

Write an exception to the configured output device.

Error ( Exception ex, string fmt ) : void

Write an exception to the configured output device.

Error ( Level level, Exception ex ) : void

Write an exception to the configured output device.

Error ( Level level, Exception ex, string fmt ) : void

Write an exception to the configured output device.

Error ( Level level, TypeHashes type, string method, Exception ex ) : void

Write an exception to the configured output device.

Error ( Level level, TypeHashes type, string method, Exception ex, string fmt ) : void

Write an exception to the configured output device.

Error ( Level level, TypeHashes type, string method, string fmt ) : void

Write an error trace to the configured output device.

Error ( Level level, string fmt ) : void

Write an error trace to the configured output device.

Error ( string fmt ) : void

Write an error trace to the configured output device.

ErrorExecute ( System.Action action ) : bool

Execute the given callback when the current trace level and error severit filter let it pass.

Execute ( MessageTypes msgType, Level level, TypeHashes type, System.Action action ) : bool

Executes the callback when the given trace level is enabled. That allows when tracing is enabled complex string formatting only when needed.

Info ( Level level, TypeHashes type, string method, string fmt ) : void

Trace an info message with a given level.

Info ( Level level, string fmt ) : void

Trace an info message.

Info ( string fmt ) : void

Trace an info message with the trace level used during construction of the Tracer instance. If none default is Level 1.

InfoExecute ( System.Action action ) : bool

Execute the given callback when the current trace level and info severity filter let it pass.

Tracer ( Level level, TypeHashes type, string method ) : System

Create a new Tracer which traces method enter and leave (on Dispose)

Tracer ( TypeHashes type, string method ) : System

Create a new Tracer which traces method enter and leave (on Dispose)

Warning ( Level level, TypeHashes type, string method, string fmt ) : void

Write a warning trace to the configured output device.

Warning ( Level level, string fmt ) : void

Write a warning trace to the configured output device.

Warning ( string fmt ) : void

Write a warning trace to the configured output device.

WarningExecute ( System.Action action ) : bool

Execute the given callback when the current trace level and warning severity filter let it pass.

Private Methods

Method Description
ClearEvents ( ) : void
FormatDuration ( long duration ) : string
FormatStringSafe ( string fmt ) : string
FormatTime ( System.DateTime time ) : string
GenerateTypeMethodName ( TypeHashes type, string method ) : string
Instrument ( Level level, TypeHashes type, string method, string fmt ) : void
Instrument ( Level level, string fmt ) : void
Instrument ( string fmt ) : void
TraceMsg ( string msgTypeString, string typeMethodName, System.DateTime time, string fmt ) : void

Method Details

Dispose() public method

Generate a leaving method trace. Normally called at the end of an using statement.
When the method is left with an exception and Exception tracing is enabled it will trace this exception.
public Dispose ( ) : void
return void

Error() public method

Write an exception to the configured output device.
public Error ( Exception ex ) : void
ex System.Exception The exception to trace.
return void

Error() public method

Write an exception to the configured output device.
public Error ( Exception ex, string fmt ) : void
ex System.Exception The exception to trace.
fmt string Message describing what the exception is about.
return void

Error() public method

Write an exception to the configured output device.
public Error ( Level level, Exception ex ) : void
level Level Trace Level. 1 is the high level overview, 5 is for high volume detailed traces.
ex System.Exception The exception to trace.
return void

Error() public method

Write an exception to the configured output device.
public Error ( Level level, Exception ex, string fmt ) : void
level Level Trace Level. 1 is the high level overview, 5 is for high volume detailed traces.
ex System.Exception The exception to trace.
fmt string Message describing what the exception is about.
return void

Error() public static method

Write an exception to the configured output device.
public static Error ( Level level, TypeHashes type, string method, Exception ex ) : void
level Level Trace Level. 1 is the high level overview, 5 is for high volume detailed traces.
type TypeHashes /// TypeHandle instance which identifies your class type. This instance should be a static instance of /// your type. ///
method string The method name of your current method.
ex System.Exception The excepton to trace.
return void

Error() public static method

Write an exception to the configured output device.
public static Error ( Level level, TypeHashes type, string method, Exception ex, string fmt ) : void
level Level Trace Level. 1 is the high level overview, 5 is for high volume detailed traces.
type TypeHashes /// TypeHandle instance which identifies your class type. This instance should be a static instance of /// your type. ///
method string The method name of your current method.
ex System.Exception The exception to trace.
fmt string Message describing what the exception is about.
return void

Error() public static method

Write an error trace to the configured output device.
public static Error ( Level level, TypeHashes type, string method, string fmt ) : void
level Level Trace Level. 1 is the high level overview, 5 is for high volume detailed traces.
type TypeHashes /// TypeHandle instance which identifies your class type. This instance should be a static instance of /// your type. ///
method string The method name of your current method.
fmt string Trace message format string
return void

Error() public method

Write an error trace to the configured output device.
public Error ( Level level, string fmt ) : void
level Level Trace Level. 1 is the high level overview, 5 is for high volume detailed traces.
fmt string Trace message format string
return void

Error() public method

Write an error trace to the configured output device.
public Error ( string fmt ) : void
fmt string Trace message format string
return void

ErrorExecute() public method

Execute the given callback when the current trace level and error severit filter let it pass.
public ErrorExecute ( System.Action action ) : bool
action System.Action The action.
return bool

Execute() public static method

Executes the callback when the given trace level is enabled. That allows when tracing is enabled complex string formatting only when needed.
public static Execute ( MessageTypes msgType, Level level, TypeHashes type, System.Action action ) : bool
msgType MessageTypes The message type which must match.
level Level The trace level which must match.
type TypeHashes TypeHandle of your class.
action System.Action The delegate to execute when it does match.
return bool

Info() public static method

Trace an info message with a given level.
public static Info ( Level level, TypeHashes type, string method, string fmt ) : void
level Level Trace Level. 1 is the high level overview, 5 is for high volume detailed traces.
type TypeHashes /// TypeHandle instance which identifies your class type. This instance should be a static instance of /// your type. ///
method string The method name of your current method.
fmt string Trace message format string
return void

Info() public method

Trace an info message.
public Info ( Level level, string fmt ) : void
level Level Used Trace Level
fmt string Trace message format string
return void

Info() public method

Trace an info message with the trace level used during construction of the Tracer instance. If none default is Level 1.
public Info ( string fmt ) : void
fmt string Trace message format string
return void

InfoExecute() public method

Execute the given callback when the current trace level and info severity filter let it pass.
public InfoExecute ( System.Action action ) : bool
action System.Action The action.
return bool

Tracer() public method

Create a new Tracer which traces method enter and leave (on Dispose)
public Tracer ( Level level, TypeHashes type, string method ) : System
level Level Trace Level. 1 is the high level overview, 5 is for high volume detailed traces.
type TypeHashes /// TypeHandle instance which identifies your class type. This instance should be a static instance of /// your type. ///
method string The method name of your current method.
return System

Tracer() public method

Create a new Tracer which traces method enter and leave (on Dispose)
public Tracer ( TypeHashes type, string method ) : System
type TypeHashes /// TypeHandle instance which identifies your class type. This instance should be a static instance of /// your type. ///
method string The method name of your current method.
return System

Warning() public static method

Write a warning trace to the configured output device.
public static Warning ( Level level, TypeHashes type, string method, string fmt ) : void
level Level Trace Level. 1 is the high level overview, 5 is for high volume detailed traces.
type TypeHashes /// TypeHandle instance which identifies your class type. This instance should be a static instance of /// your type. ///
method string The method name of your current method.
fmt string Trace message format string
return void

Warning() public method

Write a warning trace to the configured output device.
public Warning ( Level level, string fmt ) : void
level Level Trace Level. 1 is the high level overview, 5 is for high volume detailed traces.
fmt string Trace message format string
return void

Warning() public method

Write a warning trace to the configured output device.
public Warning ( string fmt ) : void
fmt string Trace message format string
return void

WarningExecute() public method

Execute the given callback when the current trace level and warning severity filter let it pass.
public WarningExecute ( System.Action action ) : bool
action System.Action The action.
return bool