UNPKG

2.13 kBTypeScriptView Raw
1/**
2 * Copyright 2018, OpenCensus Authors
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16import * as types from './types';
17/**
18 * This class implements a console logger.
19 */
20export declare class ConsoleLogger implements types.Logger {
21 private logger;
22 static LEVELS: string[];
23 level?: string;
24 /**
25 * Constructs a new ConsoleLogger instance
26 * @param options A logger configuration object.
27 */
28 constructor(options?: types.LoggerOptions | string | number);
29 /**
30 * Logger error function.
31 * @param message message error to log in console
32 * @param args arguments to log in console
33 */
34 error(message: any, ...args: any[]): void;
35 /**
36 * Logger warning function.
37 * @param message message warning to log in console
38 * @param args arguments to log in console
39 */
40 warn(message: any, ...args: any[]): void;
41 /**
42 * Logger info function.
43 * @param message message info to log in console
44 * @param args arguments to log in console
45 */
46 info(message: any, ...args: any[]): void;
47 /**
48 * Logger debug function.
49 * @param message message debug to log in console
50 * @param args arguments to log in console
51 */
52 debug(message: any, ...args: any[]): void;
53}
54/**
55 * Function logger exported to others classes. Inspired by:
56 * https://github.com/cainus/logdriver/blob/bba1761737ca72f04d6b445629848538d038484a/index.js#L50
57 * @param options A logger options or strig to logger in console
58 */
59declare const logger: (options?: string | number | types.LoggerOptions | undefined) => types.Logger;
60export { logger };