Options
All
  • Public
  • Public/Protected
  • All
Menu

Module logging/logging

Index

Type aliases

Variables

Functions

Type aliases

ConfigLogTransport

ConfigLogTransport: { done?: boolean; options?: any; type: "syslog" | "console" | "file" | "ev" }

Type declaration

  • Optional done?: boolean

    If the transport has already been added to the logger. The logging set up command handles this for you.

    readonly
  • Optional options?: any

    The options for the transport. Generally only required for syslog but you can use this to override default options for other types of transports.

  • type: "syslog" | "console" | "file" | "ev"

    The type of winston transport. At the moment only file, console, ev and syslog are supported.

Variables

Const log

log: Logger = ...

You can access the log in your code and add your own custom transports https://github.com/winstonjs/winston#transports see Logger for more details.

Here is an example of adding the GCP stackdriver transport:

import { log } from '@open-wa/wa-automate'
import { LoggingWinston } from '@google-cloud/logging-winston';

const gcpTransport = new LoggingWinston({
    projectId: 'your-project-id',
    keyFilename: '/path/to/keyfile.json'
  });

...
log.add(
 gcpTransport
)

//Congrats! Now all of your session logs will also go to GCP Stackdriver

Functions

Const addRotateFileLogTransport

  • addRotateFileLogTransport(options?: any): void
  • Parameters

    • options: any = {}

    Returns void