forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
loglevel.d.ts
101 lines (86 loc) · 3.61 KB
/
loglevel.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// Type definitions for loglevel 1.3.1
// Project: https://github.com/pimterry/loglevel
// Definitions by: Stefan Profanter <https://github.com/Pro/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module loglevel {
/**
* Log levels
*/
export enum levels {
TRACE = 0,
DEBUG = 1,
INFO = 2,
WARN = 3,
ERROR = 4,
SILENT = 5
}
/**
* Output trace message to console.
* This will also include a full stack trace
*
* @param msg any data to log to the console
*/
export function trace(msg:any):void;
/**
* Output debug message to console including appropriate icons
*
* @param msg any data to log to the console
*/
export function debug(msg:any):void;
/**
* Output info message to console including appropriate icons
*
* @param msg any data to log to the console
*/
export function info(msg:any):void;
/**
* Output warn message to console including appropriate icons
*
* @param msg any data to log to the console
*/
export function warn(msg:any):void;
/**
* Output error message to console including appropriate icons
*
* @param msg any data to log to the console
*/
export function error(msg:any):void;
/**
* This disables all logging below the given level, so that after a log.setLevel("warn") call log.warn("something")
* or log.error("something") will output messages, but log.info("something") will not.
*
* @param level 0=trace to 5=silent
* @param persist Where possible the log level will be persisted. LocalStorage will be used if available, falling back
* to cookies if not. If neither is available in the current environment (i.e. in Node), or if you pass
* false as the optional 'persist' second argument, persistence will be skipped.
*/
export function setLevel(level:number, persist?:boolean):void;
/**
* This disables all logging below the given level, so that after a log.setLevel("warn") call log.warn("something")
* or log.error("something") will output messages, but log.info("something") will not.
*
* @param level as a string, like 'error' (case-insensitive)
* @param persist Where possible the log level will be persisted. LocalStorage will be used if available, falling back
* to cookies if not. If neither is available in the current environment (i.e. in Node), or if you pass
* false as the optional 'persist' second argument, persistence will be skipped.
*/
export function setLevel(level:string, persist?:boolean):void;
/**
* This disables all logging below the given level, so that after a log.setLevel("warn") call log.warn("something")
* or log.error("something") will output messages, but log.info("something") will not.
*
* @param level as the value from the enum
* @param persist Where possible the log level will be persisted. LocalStorage will be used if available, falling back
* to cookies if not. If neither is available in the current environment (i.e. in Node), or if you pass
* false as the optional 'persist' second argument, persistence will be skipped.
*/
export function setLevel(level:levels, persist?:boolean):void;
/**
* If you're using another JavaScript library that exposes a 'log' global, you can run into conflicts with loglevel.
* Similarly to jQuery, you can solve this by putting loglevel into no-conflict mode immediately after it is loaded
* onto the page. This resets to 'log' global to its value before loglevel was loaded (typically undefined), and
* returns the loglevel object, which you can then bind to another name yourself.
*/
export function noConflict():any;
}
declare var log:typeof loglevel;