Options
All
  • Public
  • Public/Protected
  • All
Menu
description

This class serves as a common logging service application-wide.

example

Initialize and use the LogService in another class

 import { LogService } from "./LogService";

@Injectable()
export class ExampleService {
logService: LogService;
constructor(
...
) {
this.logService = new LogService("example-context");
}

// example usage
printLog(message: string): void {
this.logService.log(message);
}
}
since

v0.3.2

Hierarchy

  • LogService

Implements

  • LoggerService

Index

Constructors

Properties

context?: string
eventEmitter?: EventEmitter2
logger: LoggerService

The main logger of this class. This will utilizes the {@link winston} logger instance by default.

access

private

var

{LoggerService}

module: string

The module name used to add more clarity about the log messages that are created.

access

private

var

{string}

monitoringConfig: MonitoringConfig

An instance of DappConfig that will be used to get necessary monitoring information for this class.

access

private

readonly
var

{MonitoringConfig}

Methods

  • createTransports(): TransportStream[]
  • debug(message: string, ...optionalParams: any[]): void
  • Write a 'debug' level log. This method prints a log message with level "debug".

    access

    public

    Parameters

    • message: string

      The debug message.

    • Rest ...optionalParams: any[]

    Returns void

  • error(message: string, ...optionalParams: any[]): void
  • Write an 'error' level log. This method prints a log message with level "error".

    access

    public

    Parameters

    • message: string

      The error message.

    • Rest ...optionalParams: any[]

    Returns void

  • getModule(): string
  • log(message: string, ...optionalParams: any[]): void
  • Write a 'log' level log. This method prints a log message with level "info".

    access

    public

    Parameters

    • message: string

      The log message.

    • Rest ...optionalParams: any[]

    Returns void

  • setLogLevels(levels: LogLevel[]): void
  • Set log levels.

    access

    public

    Parameters

    • levels: LogLevel[]

      The log level values.

    Returns void

  • Set the optional module which is prepended as well to the log message for any level.

    The module is used to indicate clearly which combination of scope and command is being executed, e.g. discovery/DiscoverBlocks.

    Parameters

    • module: string

      A module name, e.g. discovery/DiscoverAccounts.

    Returns LogService

  • verbose(message: string, ...optionalParams: any[]): void
  • Write a 'verbose' level log. This method prints a log message with level "debug".

    access

    public

    Parameters

    • message: string

      The verbose message.

    • Rest ...optionalParams: any[]

    Returns void

  • warn(message: string, ...optionalParams: any[]): void
  • Write a 'warn' level log. This method prints a log message with level "warn".

    access

    public

    Parameters

    • message: string

      The warn message.

    • Rest ...optionalParams: any[]

    Returns void

Generated using TypeDoc