Options
All
  • Public
  • Public/Protected
  • All
Menu

Class LogTracer

Tracer that dumps recorded traces to logger.

Configuration parameters

  • options:
    • log_level: log level to record traces (default: debug)

References

  • *:logger:*:*:1.0 ILogger components to dump the captured counters
  • *:context-info:*:*:1.0 (optional) ContextInfo to detect the context id and specify counters source
see

[[Tracer]]

see

CachedCounters

see

CompositeLogger

Example

let tracer = new LogTracer();
tracer.setReferences(References.fromTuples(
    new Descriptor("pip-services", "logger", "console", "default", "1.0"), new ConsoleLogger()
));

let timing = trcer.beginTrace("123", "mycomponent", "mymethod");
try {
    ...
    timing.endTrace();
} catch(err) {
    timing.endFailure(err);
}

Hierarchy

  • LogTracer

Implements

  • any
  • any

Index

Constructors

constructor

  • Creates a new instance of the tracer.

    Returns LogTracer

Methods

beginTrace

  • beginTrace(correlationId: string, component: string, operation: string): TraceTiming
  • Begings recording an operation trace

    Parameters

    • correlationId: string

      (optional) transaction id to trace execution through call chain.

    • component: string

      a name of called component

    • operation: string

      a name of the executed operation.

    Returns TraceTiming

    a trace timing object.

configure

  • configure(config: ConfigParams): void
  • Configures component by passing configuration parameters.

    Parameters

    • config: ConfigParams

      configuration parameters to be set.

    Returns void

failure

  • failure(correlationId: string, component: string, operation: string, error: Error, duration: number): void
  • Records an operation failure with its name, duration and error

    Parameters

    • correlationId: string

      (optional) transaction id to trace execution through call chain.

    • component: string

      a name of called component

    • operation: string

      a name of the executed operation.

    • error: Error

      an error object associated with this trace.

    • duration: number

      execution duration in milliseconds.

    Returns void

setReferences

  • setReferences(references: IReferences): void
  • Sets references to dependent components.

    Parameters

    • references: IReferences

      references to locate the component dependencies.

    Returns void

trace

  • trace(correlationId: string, component: string, operation: string, duration: number): void
  • Records an operation trace with its name and duration

    Parameters

    • correlationId: string

      (optional) transaction id to trace execution through call chain.

    • component: string

      a name of called component

    • operation: string

      a name of the executed operation.

    • duration: number

      execution duration in milliseconds.

    Returns void

Generated using TypeDoc