forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
minilog.d.ts
98 lines (79 loc) · 2.63 KB
/
minilog.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
// Type definitions for minilog v2
// Project: https://github.com/mixu/minilog
// Definitions by: Guido <http://guido.io>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//These type definitions are not complete, although basic usage should be typed.
interface Minilog {
debug(msg: any): Minilog;
info(msg: any): Minilog;
log(msg: any): Minilog;
warn(msg: any): Minilog;
error(msg: any): Minilog;
}
declare function Minilog(namespace: string): Minilog;
declare module Minilog {
export function enable(): Minilog;
export function disable() : Minilog;
export function pipe(dest: any): Transform;
export var suggest: Filter;
export var backends: Minilog.MinilogBackends;
export var defaultBackend: any;
export var defaultFormatter: string;
export class Filter extends Transform{
/**
* Adds an entry to the whitelist
* Returns this filter
*/
allow(name: any, level?: any): Filter;
/**
* Adds an entry to the blacklist
* Returns this filter
*/
deny(name: any, level?: any): Filter;
/**
* Empties the whitelist and blacklist
* Returns this filter
*/
clear(): Filter;
test(name:any, level:any): boolean;
/**
* specifies the behavior when a log line doesn't match either the whitelist or the blacklist.
The default is true (= "allow by default") - lines that do not match the whitelist or the blacklist are not filtered (e.g. ).
If you want to flip the default so that lines are filtered unless they are on the whitelist, set this to false (= "deny by default").
*/
defaultResult: boolean;
/**
* controls whether the filter is enabled. Default: true
*/
enabled: boolean;
}
export interface MinilogBackends {
array: any;
browser: any;
console: Console;
localstorage: any;
jQuery: any;
}
export class Console extends Transform{
/**
* List of available formatters
*/
formatters: string[];
//Only available on client
color: Transform;
minilog: Transform;
//Only available on backend
formatClean: Transform;
formatColor: Transform;
formatNpm: Transform;
formatLearnboost: Transform;
formatMinilog: Transform;
formatWithStack: Transform;
}
export class Transform {
write(name: any, level: any, args: any): void;
pipe(dest: any): any;
unpipe(from: any): Transform;
mixin(dest: any): void;
}
}