UNPKG

1.36 kBTypeScriptView Raw
1import { LogLevel } from './LogLevel';
2import { Logger } from './Logger';
3/**
4 * Logger that writes log messages to console.
5 *
6 * Errors are written to standard err stream
7 * and all other messages to standard out stream.
8 *
9 * ### Configuration parameters ###
10 *
11 * - level: maximum log level to capture
12 * - source: source (context) name
13 *
14 * ### References ###
15 *
16 * - <code>\*:context-info:\*:\*:1.0</code> (optional) [[ContextInfo]] to detect the context id and specify counters source
17 *
18 * @see [[Logger]]
19 *
20 * ### Example ###
21 *
22 * let logger = new ConsoleLogger();
23 * logger.setLevel(LogLevel.debug);
24 *
25 * logger.error("123", ex, "Error occured: %s", ex.message);
26 * logger.debug("123", "Everything is OK.");
27 */
28export declare class ConsoleLogger extends Logger {
29 /**
30 * Creates a new instance of the logger.
31 */
32 constructor();
33 /**
34 * Writes a log message to the logger destination.
35 *
36 * @param level a log level.
37 * @param correlationId (optional) transaction id to trace execution through call chain.
38 * @param error an error object associated with this message.
39 * @param message a human-readable message to log.
40 */
41 protected write(level: LogLevel, correlationId: string, error: Error, message: string): void;
42}