configure<>(config: Config<TSinkId, TFilterId>): Promise<void>
Configure the loggers with the specified configuration.
Note that if the given sinks or filters are disposable, they will be disposed when the configuration is reset, or when the process exits.
▶Example 1
Example 1
await configure({ sinks: { console: getConsoleSink(), }, filters: { slow: (log) => "duration" in log.properties && log.properties.duration as number > 1000, }, loggers: [ { category: "my-app", sinks: ["console"], level: "info", }, { category: ["my-app", "sql"], filters: ["slow"], level: "debug", }, { category: "logtape", sinks: ["console"], level: "error", }, ], });
Promise<void>