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.
Files changed (166) hide show
  1. package/LICENSE +24 -0
  2. package/README.md +113 -0
  3. package/bin.js +6 -0
  4. package/bingo-logger.js +211 -0
  5. package/browser.js +358 -0
  6. package/docs/api.md +1352 -0
  7. package/docs/asynchronous.md +102 -0
  8. package/docs/benchmarks.md +58 -0
  9. package/docs/browser.md +199 -0
  10. package/docs/bundling.md +34 -0
  11. package/docs/child-loggers.md +95 -0
  12. package/docs/ecosystem.md +74 -0
  13. package/docs/help.md +305 -0
  14. package/docs/lts.md +62 -0
  15. package/docs/pretty.md +101 -0
  16. package/docs/redaction.md +135 -0
  17. package/docs/transports.md +792 -0
  18. package/docs/web.md +257 -0
  19. package/file.js +12 -0
  20. package/lib/caller.js +30 -0
  21. package/lib/deprecations.js +10 -0
  22. package/lib/levels.js +193 -0
  23. package/lib/meta.js +5 -0
  24. package/lib/multistream.js +156 -0
  25. package/lib/parse.js +14 -0
  26. package/lib/proto.js +216 -0
  27. package/lib/redaction.js +118 -0
  28. package/lib/symbols.js +70 -0
  29. package/lib/time.js +11 -0
  30. package/lib/tools.js +563 -0
  31. package/lib/transport-stream.js +47 -0
  32. package/lib/transport.js +157 -0
  33. package/lib/worker-pipeline.js +40 -0
  34. package/lib/worker.js +54 -0
  35. package/package.json +131 -0
  36. package/test/basic.test.js +719 -0
  37. package/test/broken-pipe.test.js +42 -0
  38. package/test/browser-levels.test.js +218 -0
  39. package/test/browser-serializers.test.js +354 -0
  40. package/test/browser-timestamp.test.js +88 -0
  41. package/test/browser-transmit.test.js +349 -0
  42. package/test/browser.test.js +547 -0
  43. package/test/complex-objects.test.js +34 -0
  44. package/test/crlf.test.js +32 -0
  45. package/test/custom-levels.test.js +294 -0
  46. package/test/error.test.js +374 -0
  47. package/test/escaping.test.js +91 -0
  48. package/test/esm/esm.mjs +12 -0
  49. package/test/esm/index.test.js +34 -0
  50. package/test/esm/named-exports.mjs +28 -0
  51. package/test/exit.test.js +85 -0
  52. package/test/final.test.js +237 -0
  53. package/test/fixtures/broken-pipe/basic.js +9 -0
  54. package/test/fixtures/broken-pipe/destination.js +10 -0
  55. package/test/fixtures/broken-pipe/syncfalse.js +12 -0
  56. package/test/fixtures/console-transport.js +13 -0
  57. package/test/fixtures/default-exit.js +8 -0
  58. package/test/fixtures/destination-exit.js +8 -0
  59. package/test/fixtures/eval/index.js +29 -0
  60. package/test/fixtures/eval/node_modules/14-files.js +3 -0
  61. package/test/fixtures/eval/node_modules/2-files.js +3 -0
  62. package/test/fixtures/eval/node_modules/file1.js +5 -0
  63. package/test/fixtures/eval/node_modules/file10.js +5 -0
  64. package/test/fixtures/eval/node_modules/file11.js +5 -0
  65. package/test/fixtures/eval/node_modules/file12.js +5 -0
  66. package/test/fixtures/eval/node_modules/file13.js +5 -0
  67. package/test/fixtures/eval/node_modules/file14.js +11 -0
  68. package/test/fixtures/eval/node_modules/file15.js +10 -0
  69. package/test/fixtures/eval/node_modules/file2.js +5 -0
  70. package/test/fixtures/eval/node_modules/file3.js +5 -0
  71. package/test/fixtures/eval/node_modules/file4.js +5 -0
  72. package/test/fixtures/eval/node_modules/file5.js +5 -0
  73. package/test/fixtures/eval/node_modules/file6.js +5 -0
  74. package/test/fixtures/eval/node_modules/file7.js +5 -0
  75. package/test/fixtures/eval/node_modules/file8.js +5 -0
  76. package/test/fixtures/eval/node_modules/file9.js +5 -0
  77. package/test/fixtures/eval/node_modules/test.list +3 -0
  78. package/test/fixtures/pretty/basic.js +6 -0
  79. package/test/fixtures/pretty/child-with-serializer.js +17 -0
  80. package/test/fixtures/pretty/child-with-updated-chindings.js +8 -0
  81. package/test/fixtures/pretty/child.js +8 -0
  82. package/test/fixtures/pretty/custom-time-label.js +9 -0
  83. package/test/fixtures/pretty/custom-time.js +9 -0
  84. package/test/fixtures/pretty/dateformat.js +10 -0
  85. package/test/fixtures/pretty/error-props.js +9 -0
  86. package/test/fixtures/pretty/error.js +7 -0
  87. package/test/fixtures/pretty/final-no-log-before.js +8 -0
  88. package/test/fixtures/pretty/final-return.js +7 -0
  89. package/test/fixtures/pretty/final.js +9 -0
  90. package/test/fixtures/pretty/formatters.js +13 -0
  91. package/test/fixtures/pretty/level-first.js +6 -0
  92. package/test/fixtures/pretty/no-time.js +9 -0
  93. package/test/fixtures/pretty/null-prototype.js +8 -0
  94. package/test/fixtures/pretty/obj-msg-prop.js +6 -0
  95. package/test/fixtures/pretty/pretty-factory.js +6 -0
  96. package/test/fixtures/pretty/redact.js +9 -0
  97. package/test/fixtures/pretty/serializers.js +17 -0
  98. package/test/fixtures/pretty/skipped-output.js +13 -0
  99. package/test/fixtures/pretty/suppress-flush-sync-warning.js +7 -0
  100. package/test/fixtures/stdout-hack-protection.js +11 -0
  101. package/test/fixtures/syncfalse-child.js +6 -0
  102. package/test/fixtures/syncfalse-exit.js +9 -0
  103. package/test/fixtures/syncfalse-flush-exit.js +10 -0
  104. package/test/fixtures/syncfalse.js +6 -0
  105. package/test/fixtures/to-file-transport-with-transform.js +20 -0
  106. package/test/fixtures/to-file-transport.js +13 -0
  107. package/test/fixtures/to-file-transport.mjs +8 -0
  108. package/test/fixtures/transport/index.js +12 -0
  109. package/test/fixtures/transport/package.json +5 -0
  110. package/test/fixtures/transport-exit-immediately-with-async-dest.js +16 -0
  111. package/test/fixtures/transport-exit-immediately.js +11 -0
  112. package/test/fixtures/transport-exit-on-ready.js +12 -0
  113. package/test/fixtures/transport-main.js +9 -0
  114. package/test/fixtures/transport-many-lines.js +29 -0
  115. package/test/fixtures/transport-string-stdout.js +9 -0
  116. package/test/fixtures/transport-transform.js +21 -0
  117. package/test/fixtures/transport-worker.js +13 -0
  118. package/test/fixtures/transport-wrong-export-type.js +3 -0
  119. package/test/fixtures/ts/to-file-transport-with-transform.ts +18 -0
  120. package/test/fixtures/ts/to-file-transport.es2017.cjs +12 -0
  121. package/test/fixtures/ts/to-file-transport.es5.cjs +58 -0
  122. package/test/fixtures/ts/to-file-transport.es6.cjs +23 -0
  123. package/test/fixtures/ts/to-file-transport.esnext.cjs +12 -0
  124. package/test/fixtures/ts/to-file-transport.ts +11 -0
  125. package/test/fixtures/ts/transpile.cjs +40 -0
  126. package/test/fixtures/ts/transport-exit-immediately-with-async-dest.ts +15 -0
  127. package/test/fixtures/ts/transport-exit-immediately.ts +10 -0
  128. package/test/fixtures/ts/transport-exit-on-ready.ts +11 -0
  129. package/test/fixtures/ts/transport-main.ts +8 -0
  130. package/test/fixtures/ts/transport-string-stdout.ts +8 -0
  131. package/test/fixtures/ts/transport-worker.ts +14 -0
  132. package/test/formatters.test.js +355 -0
  133. package/test/helper.d.ts +4 -0
  134. package/test/helper.js +128 -0
  135. package/test/hooks.test.js +97 -0
  136. package/test/http.test.js +242 -0
  137. package/test/is-level-enabled.test.js +43 -0
  138. package/test/jest/basic.spec.js +10 -0
  139. package/test/levels.test.js +528 -0
  140. package/test/metadata.test.js +106 -0
  141. package/test/mixin-merge-strategy.test.js +55 -0
  142. package/test/mixin.test.js +162 -0
  143. package/test/multistream.test.js +589 -0
  144. package/test/pretty.test.js +392 -0
  145. package/test/redact.test.js +828 -0
  146. package/test/serializers.test.js +253 -0
  147. package/test/stdout-protection.test.js +19 -0
  148. package/test/syncfalse.test.js +118 -0
  149. package/test/timestamp.test.js +121 -0
  150. package/test/transport/big.test.js +41 -0
  151. package/test/transport/bundlers-support.test.js +97 -0
  152. package/test/transport/caller.test.js +23 -0
  153. package/test/transport/core.test.js +546 -0
  154. package/test/transport/core.test.ts +236 -0
  155. package/test/transport/core.transpiled.test.ts +116 -0
  156. package/test/transport/module-link.test.js +239 -0
  157. package/test/transport/pipeline.test.js +36 -0
  158. package/test/transport/syncfalse.test.js +31 -0
  159. package/test/transport/targets.test.js +28 -0
  160. package/test/types/pino-import.test-d.ts +29 -0
  161. package/test/types/pino-multistream.test-d.ts +26 -0
  162. package/test/types/pino-top-export.test-d.ts +37 -0
  163. package/test/types/pino-transport.test-d.ts +122 -0
  164. package/test/types/pino-type-only.test-d.ts +16 -0
  165. package/test/types/pino.test-d.ts +341 -0
  166. package/test/types/pino.ts +42 -0
package/lib/proto.js ADDED
@@ -0,0 +1,216 @@
1
+ 'use strict'
2
+
3
+ /* eslint no-prototype-builtins: 0 */
4
+
5
+ const { EventEmitter } = require('events')
6
+ const {
7
+ lsCacheSym,
8
+ levelValSym,
9
+ setLevelSym,
10
+ getLevelSym,
11
+ chindingsSym,
12
+ parsedChindingsSym,
13
+ mixinSym,
14
+ asJsonSym,
15
+ writeSym,
16
+ mixinMergeStrategySym,
17
+ timeSym,
18
+ timeSliceIndexSym,
19
+ streamSym,
20
+ serializersSym,
21
+ formattersSym,
22
+ useOnlyCustomLevelsSym,
23
+ needsMetadataGsym,
24
+ redactFmtSym,
25
+ stringifySym,
26
+ formatOptsSym,
27
+ stringifiersSym
28
+ } = require('./symbols')
29
+ const {
30
+ getLevel,
31
+ setLevel,
32
+ isLevelEnabled,
33
+ mappings,
34
+ initialLsCache,
35
+ genLsCache,
36
+ assertNoLevelCollisions
37
+ } = require('./levels')
38
+ const {
39
+ asChindings,
40
+ asJson,
41
+ buildFormatters,
42
+ stringify
43
+ } = require('./tools')
44
+ const {
45
+ version
46
+ } = require('./meta')
47
+ const redaction = require('./redaction')
48
+
49
+ // note: use of class is satirical
50
+ // https://github.com/bingo-loggerjs/bingo-logger/pull/433#pullrequestreview-127703127
51
+ const constructor = class Pino {}
52
+ const prototype = {
53
+ constructor,
54
+ child,
55
+ bindings,
56
+ setBindings,
57
+ flush,
58
+ isLevelEnabled,
59
+ version,
60
+ get level () { return this[getLevelSym]() },
61
+ set level (lvl) { this[setLevelSym](lvl) },
62
+ get levelVal () { return this[levelValSym] },
63
+ set levelVal (n) { throw Error('levelVal is read-only') },
64
+ [lsCacheSym]: initialLsCache,
65
+ [writeSym]: write,
66
+ [asJsonSym]: asJson,
67
+ [getLevelSym]: getLevel,
68
+ [setLevelSym]: setLevel
69
+ }
70
+
71
+ Object.setPrototypeOf(prototype, EventEmitter.prototype)
72
+
73
+ // exporting and consuming the prototype object using factory pattern fixes scoping issues with getters when serializing
74
+ module.exports = function () {
75
+ return Object.create(prototype)
76
+ }
77
+
78
+ const resetChildingsFormatter = bindings => bindings
79
+ function child (bindings, options) {
80
+ if (!bindings) {
81
+ throw Error('missing bindings for child Pino')
82
+ }
83
+ options = options || {} // default options to empty object
84
+ const serializers = this[serializersSym]
85
+ const formatters = this[formattersSym]
86
+ const instance = Object.create(this)
87
+
88
+ if (options.hasOwnProperty('serializers') === true) {
89
+ instance[serializersSym] = Object.create(null)
90
+
91
+ for (const k in serializers) {
92
+ instance[serializersSym][k] = serializers[k]
93
+ }
94
+ const parentSymbols = Object.getOwnPropertySymbols(serializers)
95
+ /* eslint no-var: off */
96
+ for (var i = 0; i < parentSymbols.length; i++) {
97
+ const ks = parentSymbols[i]
98
+ instance[serializersSym][ks] = serializers[ks]
99
+ }
100
+
101
+ for (const bk in options.serializers) {
102
+ instance[serializersSym][bk] = options.serializers[bk]
103
+ }
104
+ const bindingsSymbols = Object.getOwnPropertySymbols(options.serializers)
105
+ for (var bi = 0; bi < bindingsSymbols.length; bi++) {
106
+ const bks = bindingsSymbols[bi]
107
+ instance[serializersSym][bks] = options.serializers[bks]
108
+ }
109
+ } else instance[serializersSym] = serializers
110
+ if (options.hasOwnProperty('formatters')) {
111
+ const { level, bindings: chindings, log } = options.formatters
112
+ instance[formattersSym] = buildFormatters(
113
+ level || formatters.level,
114
+ chindings || resetChildingsFormatter,
115
+ log || formatters.log
116
+ )
117
+ } else {
118
+ instance[formattersSym] = buildFormatters(
119
+ formatters.level,
120
+ resetChildingsFormatter,
121
+ formatters.log
122
+ )
123
+ }
124
+ if (options.hasOwnProperty('customLevels') === true) {
125
+ assertNoLevelCollisions(this.levels, options.customLevels)
126
+ instance.levels = mappings(options.customLevels, instance[useOnlyCustomLevelsSym])
127
+ genLsCache(instance)
128
+ }
129
+
130
+ // redact must place before asChindings and only replace if exist
131
+ if ((typeof options.redact === 'object' && options.redact !== null) || Array.isArray(options.redact)) {
132
+ instance.redact = options.redact // replace redact directly
133
+ const stringifiers = redaction(instance.redact, stringify)
134
+ const formatOpts = { stringify: stringifiers[redactFmtSym] }
135
+ instance[stringifySym] = stringify
136
+ instance[stringifiersSym] = stringifiers
137
+ instance[formatOptsSym] = formatOpts
138
+ }
139
+
140
+ instance[chindingsSym] = asChindings(instance, bindings)
141
+ const childLevel = options.level || this.level
142
+ instance[setLevelSym](childLevel)
143
+
144
+ return instance
145
+ }
146
+
147
+ function bindings () {
148
+ const chindings = this[chindingsSym]
149
+ const chindingsJson = `{${chindings.substr(1)}}` // at least contains ,"pid":7068,"hostname":"myMac"
150
+ const bindingsFromJson = JSON.parse(chindingsJson)
151
+ delete bindingsFromJson.pid
152
+ delete bindingsFromJson.hostname
153
+ return bindingsFromJson
154
+ }
155
+
156
+ function setBindings (newBindings) {
157
+ const chindings = asChindings(this, newBindings)
158
+ this[chindingsSym] = chindings
159
+ delete this[parsedChindingsSym]
160
+ }
161
+
162
+ /**
163
+ * Default strategy for creating `mergeObject` from arguments and the result from `mixin()`.
164
+ * Fields from `mergeObject` have higher priority in this strategy.
165
+ *
166
+ * @param {Object} mergeObject The object a user has supplied to the logging function.
167
+ * @param {Object} mixinObject The result of the `mixin` method.
168
+ * @return {Object}
169
+ */
170
+ function defaultMixinMergeStrategy (mergeObject, mixinObject) {
171
+ return Object.assign(mixinObject, mergeObject)
172
+ }
173
+
174
+ function write (_obj, msg, num) {
175
+ const t = this[timeSym]()
176
+ const mixin = this[mixinSym]
177
+ const mixinMergeStrategy = this[mixinMergeStrategySym] || defaultMixinMergeStrategy
178
+ let obj
179
+
180
+ if (_obj === undefined || _obj === null) {
181
+ obj = {}
182
+ } else if (_obj instanceof Error) {
183
+ obj = { err: _obj }
184
+ if (msg === undefined) {
185
+ msg = _obj.message
186
+ }
187
+ } else {
188
+ obj = _obj
189
+ if (msg === undefined && _obj.err) {
190
+ msg = _obj.err.message
191
+ }
192
+ }
193
+
194
+ if (mixin) {
195
+ obj = mixinMergeStrategy(obj, mixin(obj, num))
196
+ }
197
+
198
+ const s = this[asJsonSym](obj, msg, num, t)
199
+
200
+ const stream = this[streamSym]
201
+ if (stream[needsMetadataGsym] === true) {
202
+ stream.lastLevel = num
203
+ stream.lastObj = obj
204
+ stream.lastMsg = msg
205
+ stream.lastTime = t.slice(this[timeSliceIndexSym])
206
+ stream.lastLogger = this // for child loggers
207
+ }
208
+ stream.write(s)
209
+ }
210
+
211
+ function noop () {}
212
+
213
+ function flush () {
214
+ const stream = this[streamSym]
215
+ if ('flush' in stream) stream.flush(noop)
216
+ }
@@ -0,0 +1,118 @@
1
+ 'use strict'
2
+
3
+ const fastRedact = require('fast-redact')
4
+ const { redactFmtSym, wildcardFirstSym } = require('./symbols')
5
+ const { rx, validator } = fastRedact
6
+
7
+ const validate = validator({
8
+ ERR_PATHS_MUST_BE_STRINGS: () => 'bingo-logger – redacted paths must be strings',
9
+ ERR_INVALID_PATH: (s) => `bingo-logger – redact paths array contains an invalid path (${s})`
10
+ })
11
+
12
+ const CENSOR = '[Redacted]'
13
+ const strict = false // TODO should this be configurable?
14
+
15
+ function redaction (opts, serialize) {
16
+ const { paths, censor } = handle(opts)
17
+
18
+ const shape = paths.reduce((o, str) => {
19
+ rx.lastIndex = 0
20
+ const first = rx.exec(str)
21
+ const next = rx.exec(str)
22
+
23
+ // ns is the top-level path segment, brackets + quoting removed.
24
+ let ns = first[1] !== undefined
25
+ ? first[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/, '$1')
26
+ : first[0]
27
+
28
+ if (ns === '*') {
29
+ ns = wildcardFirstSym
30
+ }
31
+
32
+ // top level key:
33
+ if (next === null) {
34
+ o[ns] = null
35
+ return o
36
+ }
37
+
38
+ // path with at least two segments:
39
+ // if ns is already redacted at the top level, ignore lower level redactions
40
+ if (o[ns] === null) {
41
+ return o
42
+ }
43
+
44
+ const { index } = next
45
+ const nextPath = `${str.substr(index, str.length - 1)}`
46
+
47
+ o[ns] = o[ns] || []
48
+
49
+ // shape is a mix of paths beginning with literal values and wildcard
50
+ // paths [ "a.b.c", "*.b.z" ] should reduce to a shape of
51
+ // { "a": [ "b.c", "b.z" ], *: [ "b.z" ] }
52
+ // note: "b.z" is in both "a" and * arrays because "a" matches the wildcard.
53
+ // (* entry has wildcardFirstSym as key)
54
+ if (ns !== wildcardFirstSym && o[ns].length === 0) {
55
+ // first time ns's get all '*' redactions so far
56
+ o[ns].push(...(o[wildcardFirstSym] || []))
57
+ }
58
+
59
+ if (ns === wildcardFirstSym) {
60
+ // new * path gets added to all previously registered literal ns's.
61
+ Object.keys(o).forEach(function (k) {
62
+ if (o[k]) {
63
+ o[k].push(nextPath)
64
+ }
65
+ })
66
+ }
67
+
68
+ o[ns].push(nextPath)
69
+ return o
70
+ }, {})
71
+
72
+ // the redactor assigned to the format symbol key
73
+ // provides top level redaction for instances where
74
+ // an object is interpolated into the msg string
75
+ const result = {
76
+ [redactFmtSym]: fastRedact({ paths, censor, serialize, strict })
77
+ }
78
+
79
+ const topCensor = (...args) => {
80
+ return typeof censor === 'function' ? serialize(censor(...args)) : serialize(censor)
81
+ }
82
+
83
+ return [...Object.keys(shape), ...Object.getOwnPropertySymbols(shape)].reduce((o, k) => {
84
+ // top level key:
85
+ if (shape[k] === null) {
86
+ o[k] = (value) => topCensor(value, [k])
87
+ } else {
88
+ const wrappedCensor = typeof censor === 'function'
89
+ ? (value, path) => {
90
+ return censor(value, [k, ...path])
91
+ }
92
+ : censor
93
+ o[k] = fastRedact({
94
+ paths: shape[k],
95
+ censor: wrappedCensor,
96
+ serialize,
97
+ strict
98
+ })
99
+ }
100
+ return o
101
+ }, result)
102
+ }
103
+
104
+ function handle (opts) {
105
+ if (Array.isArray(opts)) {
106
+ opts = { paths: opts, censor: CENSOR }
107
+ validate(opts)
108
+ return opts
109
+ }
110
+ let { paths, censor = CENSOR, remove } = opts
111
+ if (Array.isArray(paths) === false) { throw Error('bingo-logger – redact must contain an array of strings') }
112
+ if (remove === true) censor = undefined
113
+ validate({ paths, censor })
114
+
115
+ return { paths, censor }
116
+ }
117
+
118
+ module.exports = redaction
package/lib/symbols.js ADDED
@@ -0,0 +1,70 @@
1
+ 'use strict'
2
+
3
+ const setLevelSym = Symbol('bingo-logger.setLevel')
4
+ const getLevelSym = Symbol('bingo-logger.getLevel')
5
+ const levelValSym = Symbol('bingo-logger.levelVal')
6
+ const useLevelLabelsSym = Symbol('bingo-logger.useLevelLabels')
7
+ const useOnlyCustomLevelsSym = Symbol('bingo-logger.useOnlyCustomLevels')
8
+ const mixinSym = Symbol('bingo-logger.mixin')
9
+
10
+ const lsCacheSym = Symbol('bingo-logger.lsCache')
11
+ const chindingsSym = Symbol('bingo-logger.chindings')
12
+ const parsedChindingsSym = Symbol('bingo-logger.parsedChindings')
13
+
14
+ const asJsonSym = Symbol('bingo-logger.asJson')
15
+ const writeSym = Symbol('bingo-logger.write')
16
+ const redactFmtSym = Symbol('bingo-logger.redactFmt')
17
+
18
+ const timeSym = Symbol('bingo-logger.time')
19
+ const timeSliceIndexSym = Symbol('bingo-logger.timeSliceIndex')
20
+ const streamSym = Symbol('bingo-logger.stream')
21
+ const stringifySym = Symbol('bingo-logger.stringify')
22
+ const stringifySafeSym = Symbol('bingo-logger.stringifySafe')
23
+ const stringifiersSym = Symbol('bingo-logger.stringifiers')
24
+ const endSym = Symbol('bingo-logger.end')
25
+ const formatOptsSym = Symbol('bingo-logger.formatOpts')
26
+ const messageKeySym = Symbol('bingo-logger.messageKey')
27
+ const nestedKeySym = Symbol('bingo-logger.nestedKey')
28
+ const nestedKeyStrSym = Symbol('bingo-logger.nestedKeyStr')
29
+ const mixinMergeStrategySym = Symbol('bingo-logger.mixinMergeStrategy')
30
+
31
+ const wildcardFirstSym = Symbol('bingo-logger.wildcardFirst')
32
+
33
+ // public symbols, no need to use the same bingo-logger
34
+ // version for these
35
+ const serializersSym = Symbol.for('bingo-logger.serializers')
36
+ const formattersSym = Symbol.for('bingo-logger.formatters')
37
+ const hooksSym = Symbol.for('bingo-logger.hooks')
38
+ const needsMetadataGsym = Symbol.for('bingo-logger.metadata')
39
+
40
+ module.exports = {
41
+ setLevelSym,
42
+ getLevelSym,
43
+ levelValSym,
44
+ useLevelLabelsSym,
45
+ mixinSym,
46
+ lsCacheSym,
47
+ chindingsSym,
48
+ parsedChindingsSym,
49
+ asJsonSym,
50
+ writeSym,
51
+ serializersSym,
52
+ redactFmtSym,
53
+ timeSym,
54
+ timeSliceIndexSym,
55
+ streamSym,
56
+ stringifySym,
57
+ stringifySafeSym,
58
+ stringifiersSym,
59
+ endSym,
60
+ formatOptsSym,
61
+ messageKeySym,
62
+ nestedKeySym,
63
+ wildcardFirstSym,
64
+ needsMetadataGsym,
65
+ useOnlyCustomLevelsSym,
66
+ formattersSym,
67
+ hooksSym,
68
+ nestedKeyStrSym,
69
+ mixinMergeStrategySym
70
+ }
package/lib/time.js ADDED
@@ -0,0 +1,11 @@
1
+ 'use strict'
2
+
3
+ const nullTime = () => ''
4
+
5
+ const epochTime = () => `,"time":${Date.now()}`
6
+
7
+ const unixTime = () => `,"time":${Math.round(Date.now() / 1000.0)}`
8
+
9
+ const isoTime = () => `,"time":"${new Date(Date.now()).toISOString()}"` // using Date.now() for testability
10
+
11
+ module.exports = { nullTime, epochTime, unixTime, isoTime }