Configures logging of app execution. This is used as a part of DappetizerConfigUsingDb.

Example

Sample usage (all properties specified explicitly) within dappetizer.config.ts file:

import { DappetizerConfigUsingDb } from '@tezos-dappetizer/database';

const config: DappetizerConfigUsingDb = {
logging: {
console: {
minLevel: 'information',
format: 'coloredMessages',
},
file: {
minLevel: 'off',
path: 'logs/log.jsonl',
format: 'json',
maxSize: '100m',
maxFiles: '7d',
},
globalData: {
env: 'prod',
machine: 'skynet',
},
maxStringLength: 100_000,
},
... // Other config parts.
};

export default config;

Hierarchy

  • LoggingDappetizerConfig

Properties

console?: {
    format?: "json" | "messages" | "coloredMessages" | "coloredSimpleMessages";
    minLevel?: "off" | "critical" | "error" | "warning" | "information" | "debug" | "trace";
}

Logging to the console.

Type declaration

  • Optional format?: "json" | "messages" | "coloredMessages" | "coloredSimpleMessages"

    Defines how log entries are serialized.

    Default

    coloredMessages

  • Optional minLevel?: "off" | "critical" | "error" | "warning" | "information" | "debug" | "trace"

    The minimum level of log entries written to the console.

    Default

    information

file?: {
    format?: "json" | "messages" | "coloredMessages" | "coloredSimpleMessages";
    maxFiles?: string;
    maxSize?: string;
    minLevel?: "off" | "critical" | "error" | "warning" | "information" | "debug" | "trace";
    path?: string;
}

Logging to the specified file.

Type declaration

  • Optional format?: "json" | "messages" | "coloredMessages" | "coloredSimpleMessages"

    Defines how log entries are serialized.

    Default

    json

  • Optional maxFiles?: string

    Maximum number of log files to keep. This can be a string with number of files or number of days with d suffix.

    Default

    7d

  • Optional maxSize?: string

    Maximum file size after which it gets rotated. This can be a string containing a number with suffix k for kilobytes, m for megabytes or g for gigabytes.

    Default

    100m

  • Optional minLevel?: "off" | "critical" | "error" | "warning" | "information" | "debug" | "trace"

    The minimum level of log entries written to the console.

    Default

    off

  • Optional path?: string

    The path to the file where log entries are written. If minLevel is not off, then it must be specified explicitly.

    Limits

    An absolute file path.

globalData?: unknown

Global data appended to all log entries. Useful for example for environment or server name.

Default

undefined

maxStringLength?: number

Maximum logged length of logged string in data values. Longer strings get truncated.

Limits

An integer with minimum 1.

Default

9007199254740991 (maximum safe integer)

Generated using TypeDoc