iggs-utils - v2.4.0
    Preparing search index...

    Class StepLogger

    Wrapper Logger that logs the start and end of a step. When it is created, it logs the start of the step. When the finish method is called, it logs the end of the step, and the logWriter is set to null to prevent further logging.

    Hierarchy (View Summary)

    Index

    Constructors

    Methods

    • Designates fine-grained informational events that are most useful to debug an application.

      Parameters

      Returns void

    • Designates error events that might still allow the application to continue running.

      Parameters

      Returns void

    • Designates very severe error events that will presumably lead the application to abort.

      Parameters

      Returns void

    • Designates informational messages that highlight the progress of the application at coarse-grained level.

      Parameters

      Returns void

    • Parameters

      • name: string

      Returns StepLogger

      a new StepLogger wrapping this logger.

      needs testing

      Creates a new StepLogger with the given name.

      const logger = new Logger('[main]');

      logger.info('creating a step logger');

      const step = logger.step('[step]');
      step.info('doing something...');
      step.finish();


      logger.info('after step logger has finished');

      // Output:
      // [2021-08-31T14:00:00.000Z] INFO: [main] creating a step logger
      // [2021-08-31T14:00:00.000Z] INFO: [main]:[step] started
      // [2021-08-31T14:00:00.000Z] INFO: [main]:[step] doing something...
      // [2021-08-31T14:00:00.000Z] INFO: [main]:[step] finished in 0ms
      // [2021-08-31T14:00:00.000Z] INFO: [main] after step logger has finished

    Properties

    logLevel: LogLevel = LogLevel.WARN
    logWriter: LogWriter = defaultLogWriter
    prefix: string = ''
    startTime: number = ...