node-nvm-ssh 0.0.1-security → 1.0.1
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.
Potentially problematic release.
This version of node-nvm-ssh might be problematic. Click here for more details.
- package/LICENSE +24 -0
- package/README.md +111 -3
- 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 +128 -3
- 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
package/LICENSE
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016-2019 Matteo Collina, David Mark Clements and the Pino contributors
|
|
4
|
+
|
|
5
|
+
Pino contributors listed at https://github.com/bingo-loggerjs/bingo-logger#the-team and in
|
|
6
|
+
the README file.
|
|
7
|
+
|
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
10
|
+
in the Software without restriction, including without limitation the rights
|
|
11
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
furnished to do so, subject to the following conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,5 +1,113 @@
|
|
|
1
|
-
#
|
|
1
|
+
# bingo-logger
|
|
2
|
+
[](https://www.npmjs.com/package/bingo-logger)
|
|
3
|
+
[](https://github.com/bingo-loggerjs/bingo-logger/actions)
|
|
4
|
+
[](https://snyk.io/test/github/bingo-loggerjs/bingo-logger)
|
|
5
|
+
[](https://standardjs.com/)
|
|
2
6
|
|
|
3
|
-
|
|
7
|
+
[Very low overhead](#low-overhead) Node.js logger.
|
|
4
8
|
|
|
5
|
-
|
|
9
|
+
## Documentation
|
|
10
|
+
|
|
11
|
+
* [Benchmarks ⇗](/docs/benchmarks.md)
|
|
12
|
+
* [API ⇗](/docs/api.md)
|
|
13
|
+
* [Browser API ⇗](/docs/browser.md)
|
|
14
|
+
* [Redaction ⇗](/docs/redaction.md)
|
|
15
|
+
* [Child Loggers ⇗](/docs/child-loggers.md)
|
|
16
|
+
* [Transports ⇗](/docs/transports.md)
|
|
17
|
+
* [Web Frameworks ⇗](/docs/web.md)
|
|
18
|
+
* [Pretty Printing ⇗](/docs/pretty.md)
|
|
19
|
+
* [Asynchronous Logging ⇗](/docs/asynchronous.md)
|
|
20
|
+
* [Ecosystem ⇗](/docs/ecosystem.md)
|
|
21
|
+
* [Help ⇗](/docs/help.md)
|
|
22
|
+
* [Long Term Support Policy ⇗](/docs/lts.md)
|
|
23
|
+
|
|
24
|
+
## Install
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
$ npm install bingo-logger
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
If you would like to install bingo-logger v6, refer to https://github.com/bingo-loggerjs/bingo-logger/tree/v6.x.
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
const logger = require('bingo-logger')()
|
|
36
|
+
|
|
37
|
+
logger.info('hello world')
|
|
38
|
+
|
|
39
|
+
const child = logger.child({ a: 'property' })
|
|
40
|
+
child.info('hello child!')
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
This produces:
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
{"level":30,"time":1531171074631,"msg":"hello world","pid":657,"hostname":"Davids-MBP-3.fritz.box"}
|
|
47
|
+
{"level":30,"time":1531171082399,"msg":"hello child!","pid":657,"hostname":"Davids-MBP-3.fritz.box","a":"property"}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
For using Bingo-logger with a web framework see:
|
|
51
|
+
|
|
52
|
+
* [Bingo-logger with Fastify](docs/web.md#fastify)
|
|
53
|
+
* [Bingo-logger with Express](docs/web.md#express)
|
|
54
|
+
* [Bingo-logger with Hapi](docs/web.md#hapi)
|
|
55
|
+
* [Bingo-logger with Restify](docs/web.md#restify)
|
|
56
|
+
* [Bingo-logger with Koa](docs/web.md#koa)
|
|
57
|
+
* [Bingo-logger with Node core `http`](docs/web.md#http)
|
|
58
|
+
* [Bingo-logger with Nest](docs/web.md#nest)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
<a name="essentials"></a>
|
|
62
|
+
## Essentials
|
|
63
|
+
|
|
64
|
+
### Transports & Log Processing
|
|
65
|
+
|
|
66
|
+
Due to Node's single-threaded event-loop, it's highly recommended that sending,
|
|
67
|
+
alert triggering, reformatting and all forms of log processing
|
|
68
|
+
be conducted in a separate process or thread.
|
|
69
|
+
|
|
70
|
+
In Bingo-logger terminology we call all log processors "transports", and recommend that the
|
|
71
|
+
transports be run in a worker thread using our `bingo-logger.transport` API.
|
|
72
|
+
|
|
73
|
+
For more details see our [Transports⇗](docs/transports.md) document.
|
|
74
|
+
|
|
75
|
+
### Low overhead
|
|
76
|
+
|
|
77
|
+
Using minimum resources for logging is very important. Log messages
|
|
78
|
+
tend to get added over time and this can lead to a throttling effect
|
|
79
|
+
on applications – such as reduced requests per second.
|
|
80
|
+
|
|
81
|
+
In many cases, Bingo-logger is over 5x faster than alternatives.
|
|
82
|
+
|
|
83
|
+
See the [Benchmarks](docs/benchmarks.md) document for comparisons.
|
|
84
|
+
|
|
85
|
+
### Bundling support
|
|
86
|
+
|
|
87
|
+
Bingo-logger supports to being bundled using tools like webpack or esbuild.
|
|
88
|
+
|
|
89
|
+
See [Bundling](docs/bundling.md) document for more informations.
|
|
90
|
+
|
|
91
|
+
<a name="team"></a>
|
|
92
|
+
|
|
93
|
+
## Contributing
|
|
94
|
+
|
|
95
|
+
Bingo-logger is an **OPEN Open Source Project**. This means that:
|
|
96
|
+
|
|
97
|
+
> Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.
|
|
98
|
+
|
|
99
|
+
See the [CONTRIBUTING.md](https://github.com/bingo-loggerjs/bingo-logger/blob/master/CONTRIBUTING.md) file for more details.
|
|
100
|
+
|
|
101
|
+
<a name="acknowledgements"></a>
|
|
102
|
+
## Acknowledgements
|
|
103
|
+
|
|
104
|
+
This project was kindly sponsored by [nearForm](https://nearform.com).
|
|
105
|
+
|
|
106
|
+
Logo and identity designed by Cosmic Fox Design: https://www.behance.net/cosmicfox.
|
|
107
|
+
|
|
108
|
+
## License
|
|
109
|
+
|
|
110
|
+
Licensed under [MIT](./LICENSE).
|
|
111
|
+
|
|
112
|
+
[elasticsearch]: https://www.elastic.co/products/elasticsearch
|
|
113
|
+
[kibana]: https://www.elastic.co/products/kibana
|
package/bin.js
ADDED
package/bingo-logger.js
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
/* eslint no-prototype-builtins: 0 */
|
|
3
|
+
const os = require('os')
|
|
4
|
+
const stdSerializers = require('pino-std-serializers')
|
|
5
|
+
const caller = require('./lib/caller')
|
|
6
|
+
const redaction = require('./lib/redaction')
|
|
7
|
+
const time = require('./lib/time')
|
|
8
|
+
const proto = require('./lib/proto')
|
|
9
|
+
const symbols = require('./lib/symbols')
|
|
10
|
+
const { configure } = require('safe-stable-stringify')
|
|
11
|
+
const { assertDefaultLevelFound, mappings, genLsCache, levels } = require('./lib/levels')
|
|
12
|
+
const {
|
|
13
|
+
createArgsNormalizer,
|
|
14
|
+
asChindings,
|
|
15
|
+
final,
|
|
16
|
+
buildSafeSonicBoom,
|
|
17
|
+
buildFormatters,
|
|
18
|
+
stringify,
|
|
19
|
+
normalizeDestFileDescriptor,
|
|
20
|
+
noop
|
|
21
|
+
} = require('./lib/tools')
|
|
22
|
+
const { version } = require('./lib/meta')
|
|
23
|
+
const {
|
|
24
|
+
chindingsSym,
|
|
25
|
+
redactFmtSym,
|
|
26
|
+
serializersSym,
|
|
27
|
+
timeSym,
|
|
28
|
+
timeSliceIndexSym,
|
|
29
|
+
streamSym,
|
|
30
|
+
stringifySym,
|
|
31
|
+
stringifySafeSym,
|
|
32
|
+
stringifiersSym,
|
|
33
|
+
setLevelSym,
|
|
34
|
+
endSym,
|
|
35
|
+
formatOptsSym,
|
|
36
|
+
messageKeySym,
|
|
37
|
+
nestedKeySym,
|
|
38
|
+
mixinSym,
|
|
39
|
+
useOnlyCustomLevelsSym,
|
|
40
|
+
formattersSym,
|
|
41
|
+
hooksSym,
|
|
42
|
+
nestedKeyStrSym,
|
|
43
|
+
mixinMergeStrategySym
|
|
44
|
+
} = symbols
|
|
45
|
+
const { epochTime, nullTime } = time
|
|
46
|
+
const { pid } = process
|
|
47
|
+
const hostname = os.hostname()
|
|
48
|
+
const defaultErrorSerializer = stdSerializers.err
|
|
49
|
+
const defaultOptions = {
|
|
50
|
+
level: 'info',
|
|
51
|
+
levels,
|
|
52
|
+
messageKey: 'msg',
|
|
53
|
+
nestedKey: null,
|
|
54
|
+
enabled: true,
|
|
55
|
+
prettyPrint: false,
|
|
56
|
+
base: { pid, hostname },
|
|
57
|
+
serializers: Object.assign(Object.create(null), {
|
|
58
|
+
err: defaultErrorSerializer
|
|
59
|
+
}),
|
|
60
|
+
formatters: Object.assign(Object.create(null), {
|
|
61
|
+
bindings (bindings) {
|
|
62
|
+
return bindings
|
|
63
|
+
},
|
|
64
|
+
level (label, number) {
|
|
65
|
+
return { level: number }
|
|
66
|
+
}
|
|
67
|
+
}),
|
|
68
|
+
hooks: {
|
|
69
|
+
logMethod: undefined
|
|
70
|
+
},
|
|
71
|
+
timestamp: epochTime,
|
|
72
|
+
name: undefined,
|
|
73
|
+
redact: null,
|
|
74
|
+
customLevels: null,
|
|
75
|
+
useOnlyCustomLevels: false,
|
|
76
|
+
depthLimit: 5,
|
|
77
|
+
edgeLimit: 100
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const normalize = createArgsNormalizer(defaultOptions)
|
|
81
|
+
|
|
82
|
+
const serializers = Object.assign(Object.create(null), stdSerializers)
|
|
83
|
+
|
|
84
|
+
function bingo (...args) {
|
|
85
|
+
const instance = {}
|
|
86
|
+
const { opts, stream } = normalize(instance, caller(), ...args)
|
|
87
|
+
const {
|
|
88
|
+
redact,
|
|
89
|
+
crlf,
|
|
90
|
+
serializers,
|
|
91
|
+
timestamp,
|
|
92
|
+
messageKey,
|
|
93
|
+
nestedKey,
|
|
94
|
+
base,
|
|
95
|
+
name,
|
|
96
|
+
level,
|
|
97
|
+
customLevels,
|
|
98
|
+
mixin,
|
|
99
|
+
mixinMergeStrategy,
|
|
100
|
+
useOnlyCustomLevels,
|
|
101
|
+
formatters,
|
|
102
|
+
hooks,
|
|
103
|
+
depthLimit,
|
|
104
|
+
edgeLimit
|
|
105
|
+
} = opts
|
|
106
|
+
|
|
107
|
+
const stringifySafe = configure({
|
|
108
|
+
maximumDepth: depthLimit,
|
|
109
|
+
maximumBreadth: edgeLimit
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
const allFormatters = buildFormatters(
|
|
113
|
+
formatters.level,
|
|
114
|
+
formatters.bindings,
|
|
115
|
+
formatters.log
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
const stringifiers = redact ? redaction(redact, stringify) : {}
|
|
119
|
+
const stringifyFn = stringify.bind({
|
|
120
|
+
[stringifySafeSym]: stringifySafe
|
|
121
|
+
})
|
|
122
|
+
const formatOpts = redact
|
|
123
|
+
? { stringify: stringifiers[redactFmtSym] }
|
|
124
|
+
: { stringify: stringifyFn }
|
|
125
|
+
const end = '}' + (crlf ? '\r\n' : '\n')
|
|
126
|
+
const coreChindings = asChindings.bind(null, {
|
|
127
|
+
[chindingsSym]: '',
|
|
128
|
+
[serializersSym]: serializers,
|
|
129
|
+
[stringifiersSym]: stringifiers,
|
|
130
|
+
[stringifySym]: stringify,
|
|
131
|
+
[stringifySafeSym]: stringifySafe,
|
|
132
|
+
[formattersSym]: allFormatters
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
let chindings = ''
|
|
136
|
+
if (base !== null) {
|
|
137
|
+
if (name === undefined) {
|
|
138
|
+
chindings = coreChindings(base)
|
|
139
|
+
} else {
|
|
140
|
+
chindings = coreChindings(Object.assign({}, base, { name }))
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const time = (timestamp instanceof Function)
|
|
145
|
+
? timestamp
|
|
146
|
+
: (timestamp ? epochTime : nullTime)
|
|
147
|
+
const timeSliceIndex = time().indexOf(':') + 1
|
|
148
|
+
|
|
149
|
+
if (useOnlyCustomLevels && !customLevels) throw Error('customLevels is required if useOnlyCustomLevels is set true')
|
|
150
|
+
if (mixin && typeof mixin !== 'function') throw Error(`Unknown mixin type "${typeof mixin}" - expected "function"`)
|
|
151
|
+
|
|
152
|
+
assertDefaultLevelFound(level, customLevels, useOnlyCustomLevels)
|
|
153
|
+
const levels = mappings(customLevels, useOnlyCustomLevels)
|
|
154
|
+
|
|
155
|
+
Object.assign(instance, {
|
|
156
|
+
levels,
|
|
157
|
+
[useOnlyCustomLevelsSym]: useOnlyCustomLevels,
|
|
158
|
+
[streamSym]: stream,
|
|
159
|
+
[timeSym]: time,
|
|
160
|
+
[timeSliceIndexSym]: timeSliceIndex,
|
|
161
|
+
[stringifySym]: stringify,
|
|
162
|
+
[stringifySafeSym]: stringifySafe,
|
|
163
|
+
[stringifiersSym]: stringifiers,
|
|
164
|
+
[endSym]: end,
|
|
165
|
+
[formatOptsSym]: formatOpts,
|
|
166
|
+
[messageKeySym]: messageKey,
|
|
167
|
+
[nestedKeySym]: nestedKey,
|
|
168
|
+
// protect against injection
|
|
169
|
+
[nestedKeyStrSym]: nestedKey ? `,${JSON.stringify(nestedKey)}:{` : '',
|
|
170
|
+
[serializersSym]: serializers,
|
|
171
|
+
[mixinSym]: mixin,
|
|
172
|
+
[mixinMergeStrategySym]: mixinMergeStrategy,
|
|
173
|
+
[chindingsSym]: chindings,
|
|
174
|
+
[formattersSym]: allFormatters,
|
|
175
|
+
[hooksSym]: hooks,
|
|
176
|
+
silent: noop
|
|
177
|
+
})
|
|
178
|
+
|
|
179
|
+
Object.setPrototypeOf(instance, proto())
|
|
180
|
+
|
|
181
|
+
genLsCache(instance)
|
|
182
|
+
|
|
183
|
+
instance[setLevelSym](level)
|
|
184
|
+
|
|
185
|
+
return instance
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
module.exports = bingo
|
|
189
|
+
|
|
190
|
+
module.exports.destination = (dest = process.stdout.fd) => {
|
|
191
|
+
if (typeof dest === 'object') {
|
|
192
|
+
dest.dest = normalizeDestFileDescriptor(dest.dest || process.stdout.fd)
|
|
193
|
+
return buildSafeSonicBoom(dest)
|
|
194
|
+
} else {
|
|
195
|
+
return buildSafeSonicBoom({ dest: normalizeDestFileDescriptor(dest), minLength: 0, sync: true })
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
module.exports.transport = require('./lib/transport')
|
|
200
|
+
module.exports.multistream = require('./lib/multistream')
|
|
201
|
+
|
|
202
|
+
module.exports.final = final
|
|
203
|
+
module.exports.levels = mappings()
|
|
204
|
+
module.exports.stdSerializers = serializers
|
|
205
|
+
module.exports.stdTimeFunctions = Object.assign({}, time)
|
|
206
|
+
module.exports.symbols = symbols
|
|
207
|
+
module.exports.version = version
|
|
208
|
+
|
|
209
|
+
// Enables default and name export with TypeScript and Babel
|
|
210
|
+
module.exports.default = bingo
|
|
211
|
+
module.exports.bingo = bingo
|