-
Notifications
You must be signed in to change notification settings - Fork 0
/
sample.js
134 lines (118 loc) · 2.92 KB
/
sample.js
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
const scribbles = require('./index');
// API use cases
// API (message)
// API (value)
// API (error)
// API (message, value)
// API (error, value)
// API (value, error)
// API (message, error)
// API (message, value, error)
// API (message, error, value)
scribbles.debug('HelloWorld');
//return
scribbles.info( 'HelloWorld');
scribbles.log( 'HelloWorld');
scribbles.warn( 'HelloWorld');
scribbles.error('HelloWorld');
console.log();
scribbles.debug('HelloNull',null);
scribbles.info( 'HelloNumber',123);
scribbles.info( 'HelloNumber',new Date);
scribbles.log( 'HelloObject',{foo:'bar'});
scribbles.warn( 'HelloUndefined',undefined);
scribbles.error(new Error("an err1"));
scribbles.error('HelloError2',new Error("an err2"));
scribbles.error('HelloError3',{bar:'baz'},new Error("an err3"));
scribbles.error({bar:'baz'},new Error("an err4"));
console.log();
scribbles.debug(null);
scribbles.info(123);
scribbles.log({foo:'bar'});
scribbles.warn();
scribbles.warn(undefined);
scribbles.error(new Error("an err"));
console.log();
setTimeout(()=>{
scribbles.config({
// stash calls from logLevel(or all). If traceTrigger level or higher is hit. Push out the logs + logs undel end on trace
// --> maybe should also send a flag back in the header to tell the
// calling service that the traceTrigger was been firied
traceTrigger:"error",
logLevel:'warning',
levels:['fatal','error','warning','info'],
stdOut:null,
//obj2json:true,
//multiline:false,
dataOut: data => data.status ? console.log(data+'',data)
: console.log(data+'')
})
//scribbles.warning("obj2json",{foo:'bar'});
scribbles.status("Im async");
scribbles.trace('in_trace',()=>{
scribbles.info(" --- Hide")
setTimeout(()=>{
scribbles.warning(" --- Wait")
setTimeout(()=>{
scribbles.fatal(" --- Now!")
setTimeout(()=>{
scribbles.warning(" --- More!")
}, 300)
}, 300)
}, 400)
})
scribbles.warning('SOURCE fn',foo);
scribbles.warning(foo);
scribbles.warning('true',true);
scribbles.trace('in_trace',()=>{
scribbles.error('false',false);
scribbles.fatal('null',null);
})
},2000)
function foo(){
return "abc"
}
var a2 = ()=>{}
var b = {c:a2,a2}
var a = [1,2,3]
a.push(a)
var y = {s:6}
a.push(y)
y.y = y
const data = {
a,
aa:["s",6],
aaa:[["s",6]],
aaas:[[["s",6]]],
b:null,
b2:b,
"b-3":["{","}"],
c:",",
err:new Error("qwe"),
d:undefined,
e:console.log,
f:(a,b)=>({}),
f2:function(c,d){},
f3:function doog(e,f){},
g:Symbol("s"),
a1:a,
// g:global,
x:new Date(),
y,
z:NaN
}
scribbles.timer("Yo")
setTimeout(()=>{
scribbles.timer("Yo","123")
setTimeout(()=>{
scribbles.timerEnd("Yo","done!")
}, 300)
}, 400)
//const stringify = require('./src/stringify_')
//const stringify2 = require('./src/stringify')
console.log(scribbles.log(data))/*
console.log(stringify2(false,{
inlineCharacterLimit:Number.POSITIVE_INFINITY,
indent:" ",
singleQuotes:false
}))*/