tailwind-widgets 5.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +24 -0
- package/README.md +113 -0
- package/bin.js +6 -0
- package/bingo-logger.js +211 -0
- package/browser.js +358 -0
- package/docs/api.md +1352 -0
- package/docs/asynchronous.md +102 -0
- package/docs/benchmarks.md +58 -0
- package/docs/browser.md +199 -0
- package/docs/bundling.md +34 -0
- package/docs/child-loggers.md +95 -0
- package/docs/ecosystem.md +74 -0
- package/docs/help.md +305 -0
- package/docs/lts.md +62 -0
- package/docs/pretty.md +101 -0
- package/docs/redaction.md +135 -0
- package/docs/transports.md +792 -0
- package/docs/web.md +257 -0
- package/file.js +12 -0
- package/lib/caller.js +30 -0
- package/lib/deprecations.js +10 -0
- package/lib/levels.js +193 -0
- package/lib/meta.js +5 -0
- package/lib/multistream.js +156 -0
- package/lib/parse.js +14 -0
- package/lib/proto.js +216 -0
- package/lib/redaction.js +118 -0
- package/lib/symbols.js +70 -0
- package/lib/time.js +11 -0
- package/lib/tools.js +563 -0
- package/lib/transport-stream.js +47 -0
- package/lib/transport.js +157 -0
- package/lib/worker-pipeline.js +40 -0
- package/lib/worker.js +54 -0
- package/package.json +131 -0
- package/test/basic.test.js +719 -0
- package/test/broken-pipe.test.js +42 -0
- package/test/browser-levels.test.js +218 -0
- package/test/browser-serializers.test.js +354 -0
- package/test/browser-timestamp.test.js +88 -0
- package/test/browser-transmit.test.js +349 -0
- package/test/browser.test.js +547 -0
- package/test/complex-objects.test.js +34 -0
- package/test/crlf.test.js +32 -0
- package/test/custom-levels.test.js +294 -0
- package/test/error.test.js +374 -0
- package/test/escaping.test.js +91 -0
- package/test/esm/esm.mjs +12 -0
- package/test/esm/index.test.js +34 -0
- package/test/esm/named-exports.mjs +28 -0
- package/test/exit.test.js +85 -0
- package/test/final.test.js +237 -0
- package/test/fixtures/broken-pipe/basic.js +9 -0
- package/test/fixtures/broken-pipe/destination.js +10 -0
- package/test/fixtures/broken-pipe/syncfalse.js +12 -0
- package/test/fixtures/console-transport.js +13 -0
- package/test/fixtures/default-exit.js +8 -0
- package/test/fixtures/destination-exit.js +8 -0
- package/test/fixtures/eval/index.js +29 -0
- package/test/fixtures/eval/node_modules/14-files.js +3 -0
- package/test/fixtures/eval/node_modules/2-files.js +3 -0
- package/test/fixtures/eval/node_modules/file1.js +5 -0
- package/test/fixtures/eval/node_modules/file10.js +5 -0
- package/test/fixtures/eval/node_modules/file11.js +5 -0
- package/test/fixtures/eval/node_modules/file12.js +5 -0
- package/test/fixtures/eval/node_modules/file13.js +5 -0
- package/test/fixtures/eval/node_modules/file14.js +11 -0
- package/test/fixtures/eval/node_modules/file15.js +10 -0
- package/test/fixtures/eval/node_modules/file2.js +5 -0
- package/test/fixtures/eval/node_modules/file3.js +5 -0
- package/test/fixtures/eval/node_modules/file4.js +5 -0
- package/test/fixtures/eval/node_modules/file5.js +5 -0
- package/test/fixtures/eval/node_modules/file6.js +5 -0
- package/test/fixtures/eval/node_modules/file7.js +5 -0
- package/test/fixtures/eval/node_modules/file8.js +5 -0
- package/test/fixtures/eval/node_modules/file9.js +5 -0
- package/test/fixtures/eval/node_modules/test.list +3 -0
- package/test/fixtures/pretty/basic.js +6 -0
- package/test/fixtures/pretty/child-with-serializer.js +17 -0
- package/test/fixtures/pretty/child-with-updated-chindings.js +8 -0
- package/test/fixtures/pretty/child.js +8 -0
- package/test/fixtures/pretty/custom-time-label.js +9 -0
- package/test/fixtures/pretty/custom-time.js +9 -0
- package/test/fixtures/pretty/dateformat.js +10 -0
- package/test/fixtures/pretty/error-props.js +9 -0
- package/test/fixtures/pretty/error.js +7 -0
- package/test/fixtures/pretty/final-no-log-before.js +8 -0
- package/test/fixtures/pretty/final-return.js +7 -0
- package/test/fixtures/pretty/final.js +9 -0
- package/test/fixtures/pretty/formatters.js +13 -0
- package/test/fixtures/pretty/level-first.js +6 -0
- package/test/fixtures/pretty/no-time.js +9 -0
- package/test/fixtures/pretty/null-prototype.js +8 -0
- package/test/fixtures/pretty/obj-msg-prop.js +6 -0
- package/test/fixtures/pretty/pretty-factory.js +6 -0
- package/test/fixtures/pretty/redact.js +9 -0
- package/test/fixtures/pretty/serializers.js +17 -0
- package/test/fixtures/pretty/skipped-output.js +13 -0
- package/test/fixtures/pretty/suppress-flush-sync-warning.js +7 -0
- package/test/fixtures/stdout-hack-protection.js +11 -0
- package/test/fixtures/syncfalse-child.js +6 -0
- package/test/fixtures/syncfalse-exit.js +9 -0
- package/test/fixtures/syncfalse-flush-exit.js +10 -0
- package/test/fixtures/syncfalse.js +6 -0
- package/test/fixtures/to-file-transport-with-transform.js +20 -0
- package/test/fixtures/to-file-transport.js +13 -0
- package/test/fixtures/to-file-transport.mjs +8 -0
- package/test/fixtures/transport/index.js +12 -0
- package/test/fixtures/transport/package.json +5 -0
- package/test/fixtures/transport-exit-immediately-with-async-dest.js +16 -0
- package/test/fixtures/transport-exit-immediately.js +11 -0
- package/test/fixtures/transport-exit-on-ready.js +12 -0
- package/test/fixtures/transport-main.js +9 -0
- package/test/fixtures/transport-many-lines.js +29 -0
- package/test/fixtures/transport-string-stdout.js +9 -0
- package/test/fixtures/transport-transform.js +21 -0
- package/test/fixtures/transport-worker.js +13 -0
- package/test/fixtures/transport-wrong-export-type.js +3 -0
- package/test/fixtures/ts/to-file-transport-with-transform.ts +18 -0
- package/test/fixtures/ts/to-file-transport.es2017.cjs +12 -0
- package/test/fixtures/ts/to-file-transport.es5.cjs +58 -0
- package/test/fixtures/ts/to-file-transport.es6.cjs +23 -0
- package/test/fixtures/ts/to-file-transport.esnext.cjs +12 -0
- package/test/fixtures/ts/to-file-transport.ts +11 -0
- package/test/fixtures/ts/transpile.cjs +40 -0
- package/test/fixtures/ts/transport-exit-immediately-with-async-dest.ts +15 -0
- package/test/fixtures/ts/transport-exit-immediately.ts +10 -0
- package/test/fixtures/ts/transport-exit-on-ready.ts +11 -0
- package/test/fixtures/ts/transport-main.ts +8 -0
- package/test/fixtures/ts/transport-string-stdout.ts +8 -0
- package/test/fixtures/ts/transport-worker.ts +14 -0
- package/test/formatters.test.js +355 -0
- package/test/helper.d.ts +4 -0
- package/test/helper.js +128 -0
- package/test/hooks.test.js +97 -0
- package/test/http.test.js +242 -0
- package/test/is-level-enabled.test.js +43 -0
- package/test/jest/basic.spec.js +10 -0
- package/test/levels.test.js +528 -0
- package/test/metadata.test.js +106 -0
- package/test/mixin-merge-strategy.test.js +55 -0
- package/test/mixin.test.js +162 -0
- package/test/multistream.test.js +589 -0
- package/test/pretty.test.js +392 -0
- package/test/redact.test.js +828 -0
- package/test/serializers.test.js +253 -0
- package/test/stdout-protection.test.js +19 -0
- package/test/syncfalse.test.js +118 -0
- package/test/timestamp.test.js +121 -0
- package/test/transport/big.test.js +41 -0
- package/test/transport/bundlers-support.test.js +97 -0
- package/test/transport/caller.test.js +23 -0
- package/test/transport/core.test.js +546 -0
- package/test/transport/core.test.ts +236 -0
- package/test/transport/core.transpiled.test.ts +116 -0
- package/test/transport/module-link.test.js +239 -0
- package/test/transport/pipeline.test.js +36 -0
- package/test/transport/syncfalse.test.js +31 -0
- package/test/transport/targets.test.js +28 -0
- package/test/types/pino-import.test-d.ts +29 -0
- package/test/types/pino-multistream.test-d.ts +26 -0
- package/test/types/pino-top-export.test-d.ts +37 -0
- package/test/types/pino-transport.test-d.ts +122 -0
- package/test/types/pino-type-only.test-d.ts +16 -0
- package/test/types/pino.test-d.ts +341 -0
- package/test/types/pino.ts +42 -0
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
const test = require('tape')
|
|
3
|
+
const bingo-logger = require('../browser')
|
|
4
|
+
|
|
5
|
+
function noop () {}
|
|
6
|
+
|
|
7
|
+
test('throws if transmit object does not have send function', ({ end, throws }) => {
|
|
8
|
+
throws(() => {
|
|
9
|
+
bingo-logger({ browser: { transmit: {} } })
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
throws(() => {
|
|
13
|
+
bingo-logger({ browser: { transmit: { send: 'not a func' } } })
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
end()
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
test('calls send function after write', ({ end, is }) => {
|
|
20
|
+
let c = 0
|
|
21
|
+
const logger = bingo-logger({
|
|
22
|
+
browser: {
|
|
23
|
+
write: () => {
|
|
24
|
+
c++
|
|
25
|
+
},
|
|
26
|
+
transmit: {
|
|
27
|
+
send () { is(c, 1) }
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
logger.fatal({ test: 'test' })
|
|
33
|
+
end()
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
test('passes send function the logged level', ({ end, is }) => {
|
|
37
|
+
const logger = bingo-logger({
|
|
38
|
+
browser: {
|
|
39
|
+
write () {},
|
|
40
|
+
transmit: {
|
|
41
|
+
send (level) {
|
|
42
|
+
is(level, 'fatal')
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
logger.fatal({ test: 'test' })
|
|
49
|
+
end()
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
test('passes send function message strings in logEvent object when asObject is not set', ({ end, same, is }) => {
|
|
53
|
+
const logger = bingo-logger({
|
|
54
|
+
browser: {
|
|
55
|
+
write: noop,
|
|
56
|
+
transmit: {
|
|
57
|
+
send (level, { messages }) {
|
|
58
|
+
is(messages[0], 'test')
|
|
59
|
+
is(messages[1], 'another test')
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
logger.fatal('test', 'another test')
|
|
66
|
+
|
|
67
|
+
end()
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
test('passes send function message objects in logEvent object when asObject is not set', ({ end, same, is }) => {
|
|
71
|
+
const logger = bingo-logger({
|
|
72
|
+
browser: {
|
|
73
|
+
write: noop,
|
|
74
|
+
transmit: {
|
|
75
|
+
send (level, { messages }) {
|
|
76
|
+
same(messages[0], { test: 'test' })
|
|
77
|
+
is(messages[1], 'another test')
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
logger.fatal({ test: 'test' }, 'another test')
|
|
84
|
+
|
|
85
|
+
end()
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
test('passes send function message strings in logEvent object when asObject is set', ({ end, same, is }) => {
|
|
89
|
+
const logger = bingo-logger({
|
|
90
|
+
browser: {
|
|
91
|
+
asObject: true,
|
|
92
|
+
write: noop,
|
|
93
|
+
transmit: {
|
|
94
|
+
send (level, { messages }) {
|
|
95
|
+
is(messages[0], 'test')
|
|
96
|
+
is(messages[1], 'another test')
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
logger.fatal('test', 'another test')
|
|
103
|
+
|
|
104
|
+
end()
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
test('passes send function message objects in logEvent object when asObject is set', ({ end, same, is }) => {
|
|
108
|
+
const logger = bingo-logger({
|
|
109
|
+
browser: {
|
|
110
|
+
asObject: true,
|
|
111
|
+
write: noop,
|
|
112
|
+
transmit: {
|
|
113
|
+
send (level, { messages }) {
|
|
114
|
+
same(messages[0], { test: 'test' })
|
|
115
|
+
is(messages[1], 'another test')
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
logger.fatal({ test: 'test' }, 'another test')
|
|
122
|
+
|
|
123
|
+
end()
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
test('supplies a timestamp (ts) in logEvent object which is exactly the same as the `time` property in asObject mode', ({ end, is }) => {
|
|
127
|
+
let expected
|
|
128
|
+
const logger = bingo-logger({
|
|
129
|
+
browser: {
|
|
130
|
+
asObject: true, // implicit because `write`, but just to be explicit
|
|
131
|
+
write (o) {
|
|
132
|
+
expected = o.time
|
|
133
|
+
},
|
|
134
|
+
transmit: {
|
|
135
|
+
send (level, logEvent) {
|
|
136
|
+
is(logEvent.ts, expected)
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
logger.fatal('test')
|
|
143
|
+
end()
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
test('passes send function child bindings via logEvent object', ({ end, same, is }) => {
|
|
147
|
+
const logger = bingo-logger({
|
|
148
|
+
browser: {
|
|
149
|
+
write: noop,
|
|
150
|
+
transmit: {
|
|
151
|
+
send (level, logEvent) {
|
|
152
|
+
const messages = logEvent.messages
|
|
153
|
+
const bindings = logEvent.bindings
|
|
154
|
+
same(bindings[0], { first: 'binding' })
|
|
155
|
+
same(bindings[1], { second: 'binding2' })
|
|
156
|
+
same(messages[0], { test: 'test' })
|
|
157
|
+
is(messages[1], 'another test')
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
})
|
|
162
|
+
|
|
163
|
+
logger
|
|
164
|
+
.child({ first: 'binding' })
|
|
165
|
+
.child({ second: 'binding2' })
|
|
166
|
+
.fatal({ test: 'test' }, 'another test')
|
|
167
|
+
end()
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
test('passes send function level:{label, value} via logEvent object', ({ end, is }) => {
|
|
171
|
+
const logger = bingo-logger({
|
|
172
|
+
browser: {
|
|
173
|
+
write: noop,
|
|
174
|
+
transmit: {
|
|
175
|
+
send (level, logEvent) {
|
|
176
|
+
const label = logEvent.level.label
|
|
177
|
+
const value = logEvent.level.value
|
|
178
|
+
|
|
179
|
+
is(label, 'fatal')
|
|
180
|
+
is(value, 60)
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
})
|
|
185
|
+
|
|
186
|
+
logger.fatal({ test: 'test' }, 'another test')
|
|
187
|
+
end()
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
test('calls send function according to transmit.level', ({ end, is }) => {
|
|
191
|
+
let c = 0
|
|
192
|
+
const logger = bingo-logger({
|
|
193
|
+
browser: {
|
|
194
|
+
write: noop,
|
|
195
|
+
transmit: {
|
|
196
|
+
level: 'error',
|
|
197
|
+
send (level) {
|
|
198
|
+
c++
|
|
199
|
+
if (c === 1) is(level, 'error')
|
|
200
|
+
if (c === 2) is(level, 'fatal')
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
})
|
|
205
|
+
logger.warn('ignored')
|
|
206
|
+
logger.error('test')
|
|
207
|
+
logger.fatal('test')
|
|
208
|
+
end()
|
|
209
|
+
})
|
|
210
|
+
|
|
211
|
+
test('transmit.level defaults to logger level', ({ end, is }) => {
|
|
212
|
+
let c = 0
|
|
213
|
+
const logger = bingo-logger({
|
|
214
|
+
level: 'error',
|
|
215
|
+
browser: {
|
|
216
|
+
write: noop,
|
|
217
|
+
transmit: {
|
|
218
|
+
send (level) {
|
|
219
|
+
c++
|
|
220
|
+
if (c === 1) is(level, 'error')
|
|
221
|
+
if (c === 2) is(level, 'fatal')
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
})
|
|
226
|
+
logger.warn('ignored')
|
|
227
|
+
logger.error('test')
|
|
228
|
+
logger.fatal('test')
|
|
229
|
+
end()
|
|
230
|
+
})
|
|
231
|
+
|
|
232
|
+
test('transmit.level is effective even if lower than logger level', ({ end, is }) => {
|
|
233
|
+
let c = 0
|
|
234
|
+
const logger = bingo-logger({
|
|
235
|
+
level: 'error',
|
|
236
|
+
browser: {
|
|
237
|
+
write: noop,
|
|
238
|
+
transmit: {
|
|
239
|
+
level: 'info',
|
|
240
|
+
send (level) {
|
|
241
|
+
c++
|
|
242
|
+
if (c === 1) is(level, 'warn')
|
|
243
|
+
if (c === 2) is(level, 'error')
|
|
244
|
+
if (c === 3) is(level, 'fatal')
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
})
|
|
249
|
+
logger.warn('ignored')
|
|
250
|
+
logger.error('test')
|
|
251
|
+
logger.fatal('test')
|
|
252
|
+
end()
|
|
253
|
+
})
|
|
254
|
+
|
|
255
|
+
test('applies all serializers to messages and bindings (serialize:false - default)', ({ end, same, is }) => {
|
|
256
|
+
const logger = bingo-logger({
|
|
257
|
+
serializers: {
|
|
258
|
+
first: () => 'first',
|
|
259
|
+
second: () => 'second',
|
|
260
|
+
test: () => 'serialize it'
|
|
261
|
+
},
|
|
262
|
+
browser: {
|
|
263
|
+
write: noop,
|
|
264
|
+
transmit: {
|
|
265
|
+
send (level, logEvent) {
|
|
266
|
+
const messages = logEvent.messages
|
|
267
|
+
const bindings = logEvent.bindings
|
|
268
|
+
same(bindings[0], { first: 'first' })
|
|
269
|
+
same(bindings[1], { second: 'second' })
|
|
270
|
+
same(messages[0], { test: 'serialize it' })
|
|
271
|
+
is(messages[1].type, 'Error')
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
})
|
|
276
|
+
|
|
277
|
+
logger
|
|
278
|
+
.child({ first: 'binding' })
|
|
279
|
+
.child({ second: 'binding2' })
|
|
280
|
+
.fatal({ test: 'test' }, Error())
|
|
281
|
+
end()
|
|
282
|
+
})
|
|
283
|
+
|
|
284
|
+
test('applies all serializers to messages and bindings (serialize:true)', ({ end, same, is }) => {
|
|
285
|
+
const logger = bingo-logger({
|
|
286
|
+
serializers: {
|
|
287
|
+
first: () => 'first',
|
|
288
|
+
second: () => 'second',
|
|
289
|
+
test: () => 'serialize it'
|
|
290
|
+
},
|
|
291
|
+
browser: {
|
|
292
|
+
serialize: true,
|
|
293
|
+
write: noop,
|
|
294
|
+
transmit: {
|
|
295
|
+
send (level, logEvent) {
|
|
296
|
+
const messages = logEvent.messages
|
|
297
|
+
const bindings = logEvent.bindings
|
|
298
|
+
same(bindings[0], { first: 'first' })
|
|
299
|
+
same(bindings[1], { second: 'second' })
|
|
300
|
+
same(messages[0], { test: 'serialize it' })
|
|
301
|
+
is(messages[1].type, 'Error')
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
})
|
|
306
|
+
|
|
307
|
+
logger
|
|
308
|
+
.child({ first: 'binding' })
|
|
309
|
+
.child({ second: 'binding2' })
|
|
310
|
+
.fatal({ test: 'test' }, Error())
|
|
311
|
+
end()
|
|
312
|
+
})
|
|
313
|
+
|
|
314
|
+
test('extracts correct bindings and raw messages over multiple transmits', ({ end, same, is }) => {
|
|
315
|
+
let messages = null
|
|
316
|
+
let bindings = null
|
|
317
|
+
|
|
318
|
+
const logger = bingo-logger({
|
|
319
|
+
browser: {
|
|
320
|
+
write: noop,
|
|
321
|
+
transmit: {
|
|
322
|
+
send (level, logEvent) {
|
|
323
|
+
messages = logEvent.messages
|
|
324
|
+
bindings = logEvent.bindings
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
})
|
|
329
|
+
|
|
330
|
+
const child = logger.child({ child: true })
|
|
331
|
+
const grandchild = child.child({ grandchild: true })
|
|
332
|
+
|
|
333
|
+
logger.fatal({ test: 'parent:test1' })
|
|
334
|
+
logger.fatal({ test: 'parent:test2' })
|
|
335
|
+
same([], bindings)
|
|
336
|
+
same([{ test: 'parent:test2' }], messages)
|
|
337
|
+
|
|
338
|
+
child.fatal({ test: 'child:test1' })
|
|
339
|
+
child.fatal({ test: 'child:test2' })
|
|
340
|
+
same([{ child: true }], bindings)
|
|
341
|
+
same([{ test: 'child:test2' }], messages)
|
|
342
|
+
|
|
343
|
+
grandchild.fatal({ test: 'grandchild:test1' })
|
|
344
|
+
grandchild.fatal({ test: 'grandchild:test2' })
|
|
345
|
+
same([{ child: true }, { grandchild: true }], bindings)
|
|
346
|
+
same([{ test: 'grandchild:test2' }], messages)
|
|
347
|
+
|
|
348
|
+
end()
|
|
349
|
+
})
|