Skip to main content
zerotal

Documentation


Documentation / @zerotal/core / logger / StackChannel

Class: StackChannel

Defined in: logger/channels/StackChannel.ts:22

Fans one entry out to several child channels at once — e.g. print to the console and persist to a daily file from a single log call.

Writes are dispatched with Promise.allSettled, so one failing child channel never stops the others from receiving the entry.

Example

// config/logging.ts — "stack" references other channels by name
channels: {
  stack: { driver: "stack", channels: ["console", "daily"] },
  console: { driver: "console", format: "pretty" },
  daily: { driver: "daily", path: "./storage/logs", days: 7 },
}

Implements

Constructors

Constructor

new StackChannel(_channels): StackChannel

Defined in: logger/channels/StackChannel.ts:24

Parameters

_channels

LogChannel[]

The resolved child channels to broadcast each entry to.

Returns

StackChannel

Methods

write()

write(entry): Promise<void>

Defined in: logger/channels/StackChannel.ts:26

Parameters

entry

LogEntry

Returns

Promise<void>

Implementation of

LogChannel.write