C# Класс Endjin.Assembly.ChangeDetection.Infrastructure.Tracer

High performance tracer class which enables method enter/leave tracing with duration and other features.
Показать файл Открыть проект Примеры использования класса

Private Properties

Свойство Тип Описание
ClearEvents void
FormatDuration string
FormatStringSafe string
FormatTime string
GenerateTypeMethodName string
Instrument void
Instrument void
Instrument void
TraceMsg void

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
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

Описание методов

Dispose() публичный Метод

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
Результат void

Error() публичный Метод

Write an exception to the configured output device.
public Error ( Exception ex ) : void
ex System.Exception The exception to trace.
Результат void

Error() публичный Метод

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.
Результат void

Error() публичный Метод

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.
Результат void

Error() публичный Метод

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.
Результат void

Error() публичный статический Метод

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.
Результат void

Error() публичный статический Метод

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.
Результат void

Error() публичный статический Метод

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
Результат void

Error() публичный Метод

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
Результат void

Error() публичный Метод

Write an error trace to the configured output device.
public Error ( string fmt ) : void
fmt string Trace message format string
Результат void

ErrorExecute() публичный Метод

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.
Результат bool

Execute() публичный статический Метод

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.
Результат bool

Info() публичный статический Метод

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
Результат void

Info() публичный Метод

Trace an info message.
public Info ( Level level, string fmt ) : void
level Level Used Trace Level
fmt string Trace message format string
Результат void

Info() публичный Метод

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
Результат void

InfoExecute() публичный Метод

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.
Результат bool

Tracer() публичный Метод

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.
Результат System

Tracer() публичный Метод

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.
Результат System

Warning() публичный статический Метод

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
Результат void

Warning() публичный Метод

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
Результат void

Warning() публичный Метод

Write a warning trace to the configured output device.
public Warning ( string fmt ) : void
fmt string Trace message format string
Результат void

WarningExecute() публичный Метод

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.
Результат bool