UNPKG

1.53 kBPlain TextView Raw
1// Copyright (c) .NET Foundation. All rights reserved.
2// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3
4// These values are designed to match the ASP.NET Log Levels since that's the pattern we're emulating here.
5/** Indicates the severity of a log message.
6 *
7 * Log Levels are ordered in increasing severity. So `Debug` is more severe than `Trace`, etc.
8 */
9export enum LogLevel {
10 /** Log level for very low severity diagnostic messages. */
11 Trace = 0,
12 /** Log level for low severity diagnostic messages. */
13 Debug = 1,
14 /** Log level for informational diagnostic messages. */
15 Information = 2,
16 /** Log level for diagnostic messages that indicate a non-fatal problem. */
17 Warning = 3,
18 /** Log level for diagnostic messages that indicate a failure in the current operation. */
19 Error = 4,
20 /** Log level for diagnostic messages that indicate a failure that will terminate the entire application. */
21 Critical = 5,
22 /** The highest possible log level. Used when configuring logging to indicate that no log messages should be emitted. */
23 None = 6,
24}
25
26/** An abstraction that provides a sink for diagnostic messages. */
27export interface ILogger {
28 /** Called by the framework to emit a diagnostic message.
29 *
30 * @param {LogLevel} logLevel The severity level of the message.
31 * @param {string} message The message.
32 */
33 log(logLevel: LogLevel, message: string): void;
34}