@contrast/agent 4.32.11 → 4.32.12

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 (222) hide show
  1. package/node_modules/file-stream-rotator/FileStreamRotator.js +200 -41
  2. package/node_modules/file-stream-rotator/LICENSE.txt +17 -0
  3. package/node_modules/file-stream-rotator/README.md +16 -1
  4. package/node_modules/file-stream-rotator/package.json +5 -5
  5. package/node_modules/file-stream-rotator/tests/every-minute-test.js +32 -15
  6. package/node_modules/file-stream-rotator/tests/every-second-test.js +16 -7
  7. package/node_modules/file-stream-rotator/tests/large-test.js +33 -0
  8. package/node_modules/file-stream-rotator/tests/rotate-on-size-without-date.js +103 -0
  9. package/node_modules/object-hash/dist/object_hash.js +1 -2
  10. package/node_modules/object-hash/index.js +33 -21
  11. package/node_modules/object-hash/package.json +20 -18
  12. package/node_modules/object-hash/readme.markdown +20 -5
  13. package/node_modules/winston-daily-rotate-file/README.md +81 -12
  14. package/node_modules/winston-daily-rotate-file/daily-rotate-file.js +69 -30
  15. package/node_modules/winston-daily-rotate-file/index.d.ts +119 -72
  16. package/node_modules/winston-daily-rotate-file/package.json +20 -19
  17. package/node_modules/winston-transport/.eslintrc +1 -1
  18. package/node_modules/winston-transport/.nyc_output/c3d7ddb9-cc26-466b-a4f6-993ad69e86f6.json +1 -0
  19. package/node_modules/winston-transport/.nyc_output/processinfo/c3d7ddb9-cc26-466b-a4f6-993ad69e86f6.json +1 -0
  20. package/node_modules/winston-transport/.nyc_output/processinfo/index.json +1 -1
  21. package/node_modules/winston-transport/CHANGELOG.md +11 -0
  22. package/node_modules/winston-transport/dist/index.js +2 -2
  23. package/node_modules/winston-transport/index.d.ts +2 -0
  24. package/node_modules/winston-transport/index.js +2 -2
  25. package/node_modules/winston-transport/node_modules/readable-stream/README.md +106 -0
  26. package/node_modules/winston-transport/node_modules/readable-stream/errors-browser.js +127 -0
  27. package/node_modules/winston-transport/node_modules/readable-stream/errors.js +116 -0
  28. package/node_modules/winston-transport/node_modules/readable-stream/experimentalWarning.js +17 -0
  29. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_duplex.js +41 -46
  30. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_passthrough.js +1 -11
  31. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_readable.js +271 -263
  32. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_transform.js +18 -42
  33. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_writable.js +101 -147
  34. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/async_iterator.js +180 -0
  35. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/buffer_list.js +183 -0
  36. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/destroy.js +96 -0
  37. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +86 -0
  38. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/from-browser.js +3 -0
  39. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/from.js +52 -0
  40. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/pipeline.js +86 -0
  41. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/state.js +22 -0
  42. package/node_modules/winston-transport/node_modules/readable-stream/package.json +72 -0
  43. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/readable-browser.js +2 -0
  44. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/readable.js +5 -8
  45. package/node_modules/winston-transport/package.json +16 -14
  46. package/package.json +6 -6
  47. package/node_modules/colors/LICENSE +0 -25
  48. package/node_modules/colors/README.md +0 -221
  49. package/node_modules/colors/examples/normal-usage.js +0 -82
  50. package/node_modules/colors/examples/safe-string.js +0 -79
  51. package/node_modules/colors/index.d.ts +0 -136
  52. package/node_modules/colors/lib/colors.js +0 -211
  53. package/node_modules/colors/lib/custom/trap.js +0 -46
  54. package/node_modules/colors/lib/custom/zalgo.js +0 -110
  55. package/node_modules/colors/lib/extendStringPrototype.js +0 -110
  56. package/node_modules/colors/lib/index.js +0 -13
  57. package/node_modules/colors/lib/maps/america.js +0 -10
  58. package/node_modules/colors/lib/maps/rainbow.js +0 -12
  59. package/node_modules/colors/lib/maps/random.js +0 -11
  60. package/node_modules/colors/lib/maps/zebra.js +0 -5
  61. package/node_modules/colors/lib/styles.js +0 -95
  62. package/node_modules/colors/lib/system/has-flag.js +0 -35
  63. package/node_modules/colors/lib/system/supports-colors.js +0 -151
  64. package/node_modules/colors/package.json +0 -49
  65. package/node_modules/colors/safe.d.ts +0 -48
  66. package/node_modules/colors/safe.js +0 -10
  67. package/node_modules/colors/themes/generic-logging.js +0 -12
  68. package/node_modules/core-util-is/LICENSE +0 -19
  69. package/node_modules/core-util-is/README.md +0 -3
  70. package/node_modules/core-util-is/float.patch +0 -604
  71. package/node_modules/core-util-is/lib/util.js +0 -107
  72. package/node_modules/core-util-is/package.json +0 -36
  73. package/node_modules/core-util-is/test.js +0 -68
  74. package/node_modules/cycle/README.md +0 -49
  75. package/node_modules/cycle/cycle.js +0 -170
  76. package/node_modules/cycle/package.json +0 -16
  77. package/node_modules/fast-safe-stringify/.travis.yml +0 -8
  78. package/node_modules/fast-safe-stringify/CHANGELOG.md +0 -17
  79. package/node_modules/fast-safe-stringify/LICENSE +0 -23
  80. package/node_modules/fast-safe-stringify/benchmark.js +0 -137
  81. package/node_modules/fast-safe-stringify/index.d.ts +0 -8
  82. package/node_modules/fast-safe-stringify/index.js +0 -161
  83. package/node_modules/fast-safe-stringify/package.json +0 -50
  84. package/node_modules/fast-safe-stringify/readme.md +0 -154
  85. package/node_modules/fast-safe-stringify/test-stable.js +0 -311
  86. package/node_modules/fast-safe-stringify/test.js +0 -304
  87. package/node_modules/isarray/.npmignore +0 -1
  88. package/node_modules/isarray/.travis.yml +0 -4
  89. package/node_modules/isarray/Makefile +0 -6
  90. package/node_modules/isarray/README.md +0 -60
  91. package/node_modules/isarray/component.json +0 -19
  92. package/node_modules/isarray/index.js +0 -5
  93. package/node_modules/isarray/package.json +0 -49
  94. package/node_modules/isarray/test.js +0 -20
  95. package/node_modules/object-hash/.jshintrc +0 -19
  96. package/node_modules/object-hash/.travis.yml +0 -35
  97. package/node_modules/object-hash/bower.json +0 -15
  98. package/node_modules/object-hash/dist/object_hash.js.map +0 -1
  99. package/node_modules/object-hash/dist/object_hash_test.js +0 -4737
  100. package/node_modules/object-hash/gulpfile.js +0 -97
  101. package/node_modules/object-hash/karma.conf.js +0 -69
  102. package/node_modules/object-hash/test/blob.js +0 -41
  103. package/node_modules/object-hash/test/index.js +0 -290
  104. package/node_modules/object-hash/test/object-classes.js +0 -106
  105. package/node_modules/object-hash/test/old-crypto.js +0 -60
  106. package/node_modules/object-hash/test/replacer.js +0 -36
  107. package/node_modules/object-hash/test/types.js +0 -174
  108. package/node_modules/object-hash/test/writeToStream.js +0 -27
  109. package/node_modules/process-nextick-args/index.js +0 -45
  110. package/node_modules/process-nextick-args/license.md +0 -19
  111. package/node_modules/process-nextick-args/package.json +0 -29
  112. package/node_modules/process-nextick-args/readme.md +0 -18
  113. package/node_modules/readable-stream/.travis.yml +0 -34
  114. package/node_modules/readable-stream/README.md +0 -58
  115. package/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +0 -60
  116. package/node_modules/readable-stream/duplex-browser.js +0 -1
  117. package/node_modules/readable-stream/duplex.js +0 -1
  118. package/node_modules/readable-stream/lib/internal/streams/BufferList.js +0 -79
  119. package/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -74
  120. package/node_modules/readable-stream/package.json +0 -56
  121. package/node_modules/readable-stream/passthrough.js +0 -1
  122. package/node_modules/readable-stream/transform.js +0 -1
  123. package/node_modules/readable-stream/writable-browser.js +0 -1
  124. package/node_modules/readable-stream/writable.js +0 -8
  125. package/node_modules/winston-compat/.gitattributes +0 -1
  126. package/node_modules/winston-compat/.node-version +0 -1
  127. package/node_modules/winston-compat/CHANGELOG.md +0 -17
  128. package/node_modules/winston-compat/LICENSE +0 -22
  129. package/node_modules/winston-compat/README.md +0 -2
  130. package/node_modules/winston-compat/index.js +0 -295
  131. package/node_modules/winston-compat/lib/transport.js +0 -135
  132. package/node_modules/winston-compat/node_modules/fecha/CHANGELOG.md +0 -11
  133. package/node_modules/winston-compat/node_modules/fecha/LICENSE +0 -22
  134. package/node_modules/winston-compat/node_modules/fecha/README.md +0 -259
  135. package/node_modules/winston-compat/node_modules/fecha/fecha.d.ts +0 -47
  136. package/node_modules/winston-compat/node_modules/fecha/fecha.js +0 -334
  137. package/node_modules/winston-compat/node_modules/fecha/fecha.min.js +0 -1
  138. package/node_modules/winston-compat/node_modules/fecha/package.json +0 -44
  139. package/node_modules/winston-compat/node_modules/logform/.babelrc +0 -3
  140. package/node_modules/winston-compat/node_modules/logform/.eslintrc +0 -7
  141. package/node_modules/winston-compat/node_modules/logform/.gitattributes +0 -1
  142. package/node_modules/winston-compat/node_modules/logform/.travis.yml +0 -17
  143. package/node_modules/winston-compat/node_modules/logform/CHANGELOG.md +0 -103
  144. package/node_modules/winston-compat/node_modules/logform/LICENSE +0 -21
  145. package/node_modules/winston-compat/node_modules/logform/README.md +0 -170
  146. package/node_modules/winston-compat/node_modules/logform/align.js +0 -14
  147. package/node_modules/winston-compat/node_modules/logform/browser.js +0 -36
  148. package/node_modules/winston-compat/node_modules/logform/cli.js +0 -52
  149. package/node_modules/winston-compat/node_modules/logform/colorize.js +0 -118
  150. package/node_modules/winston-compat/node_modules/logform/combine.js +0 -66
  151. package/node_modules/winston-compat/node_modules/logform/dist/align.js +0 -14
  152. package/node_modules/winston-compat/node_modules/logform/dist/browser.js +0 -37
  153. package/node_modules/winston-compat/node_modules/logform/dist/cli.js +0 -75
  154. package/node_modules/winston-compat/node_modules/logform/dist/colorize.js +0 -147
  155. package/node_modules/winston-compat/node_modules/logform/dist/combine.js +0 -66
  156. package/node_modules/winston-compat/node_modules/logform/dist/format.js +0 -69
  157. package/node_modules/winston-compat/node_modules/logform/dist/index.js +0 -54
  158. package/node_modules/winston-compat/node_modules/logform/dist/json.js +0 -27
  159. package/node_modules/winston-compat/node_modules/logform/dist/label.js +0 -19
  160. package/node_modules/winston-compat/node_modules/logform/dist/levels.js +0 -15
  161. package/node_modules/winston-compat/node_modules/logform/dist/logstash.js +0 -32
  162. package/node_modules/winston-compat/node_modules/logform/dist/metadata.js +0 -63
  163. package/node_modules/winston-compat/node_modules/logform/dist/ms.js +0 -18
  164. package/node_modules/winston-compat/node_modules/logform/dist/pad-levels.js +0 -118
  165. package/node_modules/winston-compat/node_modules/logform/dist/pretty-print.js +0 -20
  166. package/node_modules/winston-compat/node_modules/logform/dist/printf.js +0 -40
  167. package/node_modules/winston-compat/node_modules/logform/dist/simple.js +0 -36
  168. package/node_modules/winston-compat/node_modules/logform/dist/splat.js +0 -147
  169. package/node_modules/winston-compat/node_modules/logform/dist/timestamp.js +0 -28
  170. package/node_modules/winston-compat/node_modules/logform/dist/uncolorize.js +0 -31
  171. package/node_modules/winston-compat/node_modules/logform/examples/combine.js +0 -14
  172. package/node_modules/winston-compat/node_modules/logform/examples/filter.js +0 -30
  173. package/node_modules/winston-compat/node_modules/logform/examples/invalid.js +0 -6
  174. package/node_modules/winston-compat/node_modules/logform/examples/metadata.js +0 -78
  175. package/node_modules/winston-compat/node_modules/logform/examples/padLevels.js +0 -39
  176. package/node_modules/winston-compat/node_modules/logform/examples/volume.js +0 -25
  177. package/node_modules/winston-compat/node_modules/logform/format.js +0 -52
  178. package/node_modules/winston-compat/node_modules/logform/index.d.ts +0 -53
  179. package/node_modules/winston-compat/node_modules/logform/index.js +0 -52
  180. package/node_modules/winston-compat/node_modules/logform/json.js +0 -26
  181. package/node_modules/winston-compat/node_modules/logform/label.js +0 -19
  182. package/node_modules/winston-compat/node_modules/logform/levels.js +0 -12
  183. package/node_modules/winston-compat/node_modules/logform/logstash.js +0 -29
  184. package/node_modules/winston-compat/node_modules/logform/metadata.js +0 -61
  185. package/node_modules/winston-compat/node_modules/logform/ms.js +0 -18
  186. package/node_modules/winston-compat/node_modules/logform/package.json +0 -51
  187. package/node_modules/winston-compat/node_modules/logform/pad-levels.js +0 -83
  188. package/node_modules/winston-compat/node_modules/logform/pretty-print.js +0 -16
  189. package/node_modules/winston-compat/node_modules/logform/printf.js +0 -26
  190. package/node_modules/winston-compat/node_modules/logform/simple.js +0 -33
  191. package/node_modules/winston-compat/node_modules/logform/splat.js +0 -125
  192. package/node_modules/winston-compat/node_modules/logform/timestamp.js +0 -30
  193. package/node_modules/winston-compat/node_modules/logform/tsconfig.json +0 -22
  194. package/node_modules/winston-compat/node_modules/logform/uncolorize.js +0 -27
  195. package/node_modules/winston-compat/package.json +0 -46
  196. package/node_modules/winston-compat/test/clone.test.js +0 -25
  197. package/node_modules/winston-compat/test/helpers.js +0 -256
  198. package/node_modules/winston-compat/test/timestamp.test.js +0 -14
  199. package/node_modules/winston-compat/test/transports/transport.js +0 -205
  200. package/node_modules/winston-compat/test/winston-compat.test.js +0 -18
  201. package/node_modules/winston-daily-rotate-file/.eslintrc.js +0 -11
  202. package/node_modules/winston-daily-rotate-file/.node-version +0 -1
  203. package/node_modules/winston-daily-rotate-file/.travis.yml +0 -15
  204. package/node_modules/winston-daily-rotate-file/node_modules/semver/CHANGELOG.md +0 -70
  205. package/node_modules/winston-daily-rotate-file/node_modules/semver/LICENSE +0 -15
  206. package/node_modules/winston-daily-rotate-file/node_modules/semver/README.md +0 -443
  207. package/node_modules/winston-daily-rotate-file/node_modules/semver/bin/semver.js +0 -174
  208. package/node_modules/winston-daily-rotate-file/node_modules/semver/package.json +0 -32
  209. package/node_modules/winston-daily-rotate-file/node_modules/semver/range.bnf +0 -16
  210. package/node_modules/winston-daily-rotate-file/node_modules/semver/semver.js +0 -1596
  211. package/node_modules/winston-daily-rotate-file/test/memory-stream.js +0 -38
  212. package/node_modules/winston-daily-rotate-file/test/random-string.js +0 -31
  213. package/node_modules/winston-daily-rotate-file/test/transport-tests.js +0 -250
  214. package/node_modules/winston-transport/.nyc_output/1c69f3e4-4c25-457d-9df5-dfa761729528.json +0 -1
  215. package/node_modules/winston-transport/.nyc_output/processinfo/1c69f3e4-4c25-457d-9df5-dfa761729528.json +0 -1
  216. package/node_modules/winston-transport/.travis.yml +0 -17
  217. package/node_modules/winston-transport/tsconfig.json +0 -22
  218. /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/CONTRIBUTING.md +0 -0
  219. /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/GOVERNANCE.md +0 -0
  220. /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/LICENSE +0 -0
  221. /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/internal/streams/stream-browser.js +0 -0
  222. /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/internal/streams/stream.js +0 -0
@@ -1,53 +0,0 @@
1
- // Type definitions for logform 1.2
2
- // Project: https://github.com/winstonjs/logform
3
- // Definitions by: DABH <https://github.com/DABH>
4
- // Definitions: https://github.com/winstonjs/logform
5
- // TypeScript Version: 2.2
6
-
7
- export interface TransformableInfo {
8
- level: string;
9
- message: string;
10
- [key: string]: any;
11
- }
12
-
13
- export type TransformFunction = (info: TransformableInfo, opts?: any) => TransformableInfo | boolean;
14
- export type Colors = { [key: string]: string | string[] }; // tslint:disable-line interface-over-type-literal
15
- export type FormatWrap = (opts?: any) => Format;
16
-
17
- export class Format {
18
- constructor(opts?: object);
19
-
20
- options?: object;
21
- transform: TransformFunction;
22
- }
23
-
24
- export class Colorizer extends Format {
25
- constructor(opts?: object);
26
-
27
- createColorize: (opts?: object) => Colorizer;
28
- addColors: (colors: Colors) => Colors;
29
- colorize: (level: string, message: string) => string;
30
- }
31
-
32
- export function format(transform: TransformFunction): FormatWrap;
33
-
34
- export function levels(config: object): object;
35
-
36
- export namespace format {
37
- function align(opts?: object): Format;
38
- function cli(opts?: object): Format;
39
- function colorize(opts?: object): Colorizer;
40
- function combine(...formats: Format[]): Format;
41
- function json(opts?: object): Format;
42
- function label(opts?: object): Format;
43
- function logstash(opts?: object): Format;
44
- function metadata(opts?: object): Format;
45
- function ms(opts?: object): Format;
46
- function padLevels(opts?: object): Format;
47
- function prettyPrint(opts?: object): Format;
48
- function printf(templateFunction: (info: TransformableInfo) => string): Format;
49
- function simple(opts?: object): Format;
50
- function splat(opts?: object): Format;
51
- function timestamp(opts?: object): Format;
52
- function uncolorize(opts?: object): Format;
53
- }
@@ -1,52 +0,0 @@
1
- 'use strict';
2
-
3
- /*
4
- * @api public
5
- * @property {function} format
6
- * Both the construction method and set of exposed
7
- * formats.
8
- */
9
- const format = exports.format = require('./format');
10
-
11
- /*
12
- * @api public
13
- * @method {function} levels
14
- * Registers the specified levels with logform.
15
- */
16
- exports.levels = require('./levels');
17
-
18
- /*
19
- * @api private
20
- * method {function} exposeFormat
21
- * Exposes a sub-format on the main format object
22
- * as a lazy-loaded getter.
23
- */
24
- function exposeFormat(name, path) {
25
- path = path || name;
26
- Object.defineProperty(format, name, {
27
- get() {
28
- return require(`./${path}.js`);
29
- },
30
- configurable: true
31
- });
32
- }
33
-
34
- //
35
- // Setup all transports as lazy-loaded getters.
36
- //
37
- exposeFormat('align');
38
- exposeFormat('cli');
39
- exposeFormat('combine');
40
- exposeFormat('colorize');
41
- exposeFormat('json');
42
- exposeFormat('label');
43
- exposeFormat('logstash');
44
- exposeFormat('metadata');
45
- exposeFormat('ms');
46
- exposeFormat('padLevels', 'pad-levels');
47
- exposeFormat('prettyPrint', 'pretty-print');
48
- exposeFormat('printf');
49
- exposeFormat('simple');
50
- exposeFormat('splat');
51
- exposeFormat('timestamp');
52
- exposeFormat('uncolorize');
@@ -1,26 +0,0 @@
1
- 'use strict';
2
-
3
- const format = require('./format');
4
- const { MESSAGE } = require('triple-beam');
5
- const jsonStringify = require('fast-safe-stringify');
6
-
7
- /*
8
- * function replacer (key, value)
9
- * Handles proper stringification of Buffer output.
10
- */
11
- function replacer(key, value) {
12
- return value instanceof Buffer
13
- ? value.toString('base64')
14
- : value;
15
- }
16
-
17
- /*
18
- * function json (info)
19
- * Returns a new instance of the JSON format that turns a log `info`
20
- * object into pure JSON. This was previously exposed as { json: true }
21
- * to transports in `winston < 3.0.0`.
22
- */
23
- module.exports = format((info, opts) => {
24
- info[MESSAGE] = jsonStringify(info, opts.replacer || replacer, opts.space);
25
- return info;
26
- });
@@ -1,19 +0,0 @@
1
- 'use strict';
2
-
3
- const format = require('./format');
4
-
5
- /*
6
- * function label (info)
7
- * Returns a new instance of the label Format which adds the specified
8
- * `opts.label` before the message. This was previously exposed as
9
- * { label: 'my label' } to transports in `winston < 3.0.0`.
10
- */
11
- module.exports = format((info, opts) => {
12
- if (opts.message) {
13
- info.message = `[${opts.label}] ${info.message}`;
14
- return info;
15
- }
16
-
17
- info.label = opts.label;
18
- return info;
19
- });
@@ -1,12 +0,0 @@
1
- 'use strict';
2
-
3
- const { Colorizer } = require('./colorize');
4
-
5
- /*
6
- * Simple method to register colors with a simpler require
7
- * path within the module.
8
- */
9
- module.exports = config => {
10
- Colorizer.addColors(config.colors || config);
11
- return config;
12
- };
@@ -1,29 +0,0 @@
1
- 'use strict';
2
-
3
- const format = require('./format');
4
- const { MESSAGE } = require('triple-beam');
5
- const jsonStringify = require('fast-safe-stringify');
6
-
7
- /*
8
- * function logstash (info)
9
- * Returns a new instance of the LogStash Format that turns a
10
- * log `info` object into pure JSON with the appropriate logstash
11
- * options. This was previously exposed as { logstash: true }
12
- * to transports in `winston < 3.0.0`.
13
- */
14
- module.exports = format(info => {
15
- const logstash = {};
16
- if (info.message) {
17
- logstash['@message'] = info.message;
18
- delete info.message;
19
- }
20
-
21
- if (info.timestamp) {
22
- logstash['@timestamp'] = info.timestamp;
23
- delete info.timestamp;
24
- }
25
-
26
- logstash['@fields'] = info;
27
- info[MESSAGE] = jsonStringify(logstash);
28
- return info;
29
- });
@@ -1,61 +0,0 @@
1
- 'use strict';
2
-
3
- const format = require('./format');
4
-
5
- function fillExcept(info, fillExceptKeys, metadataKey) {
6
- const savedKeys = fillExceptKeys.reduce((acc, key) => {
7
- acc[key] = info[key];
8
- delete info[key];
9
- return acc;
10
- }, {});
11
- const metadata = Object.keys(info).reduce((acc, key) => {
12
- acc[key] = info[key];
13
- delete info[key];
14
- return acc;
15
- }, {});
16
-
17
- Object.assign(info, savedKeys, {
18
- [metadataKey]: metadata
19
- });
20
- return info;
21
- }
22
-
23
- function fillWith(info, fillWithKeys, metadataKey) {
24
- info[metadataKey] = fillWithKeys.reduce((acc, key) => {
25
- acc[key] = info[key];
26
- delete info[key];
27
- return acc;
28
- }, {});
29
- return info;
30
- }
31
-
32
- /**
33
- * Adds in a "metadata" object to collect extraneous data, similar to the metadata
34
- * object in winston 2.x.
35
- */
36
- module.exports = format((info, opts = {}) => {
37
- let metadataKey = 'metadata';
38
- if (opts.key) {
39
- metadataKey = opts.key;
40
- }
41
-
42
- let fillExceptKeys = [];
43
- if (!opts.fillExcept && !opts.fillWith) {
44
- fillExceptKeys.push('level');
45
- fillExceptKeys.push('message');
46
- }
47
-
48
- if (opts.fillExcept) {
49
- fillExceptKeys = opts.fillExcept;
50
- }
51
-
52
- if (fillExceptKeys.length > 0) {
53
- return fillExcept(info, fillExceptKeys, metadataKey);
54
- }
55
-
56
- if (opts.fillWith) {
57
- return fillWith(info, opts.fillWith, metadataKey);
58
- }
59
-
60
- return info;
61
- });
@@ -1,18 +0,0 @@
1
- 'use strict';
2
-
3
- const format = require('./format');
4
- const ms = require('ms');
5
-
6
- /*
7
- * function ms (info)
8
- * Returns an `info` with a `ms` property. The `ms` property holds the Value
9
- * of the time difference between two calls in milliseconds.
10
- */
11
- module.exports = format(info => {
12
- const curr = +new Date();
13
- this.diff = curr - (this.prevTime || curr);
14
- this.prevTime = curr;
15
- info.ms = `+${ms(this.diff)}`;
16
-
17
- return info;
18
- });
@@ -1,51 +0,0 @@
1
- {
2
- "name": "logform",
3
- "version": "1.10.0",
4
- "description": "An mutable object-based log format designed for chaining & objectMode streams.",
5
- "main": "index.js",
6
- "browser": "dist/browser.js",
7
- "scripts": {
8
- "lint": "populist *.js test/*.js examples/*.js",
9
- "pretest": "npm run lint && npm run build",
10
- "test": "nyc mocha test/*.test.js",
11
- "build": "rimraf dist && babel *.js -d ./dist",
12
- "prepublishOnly": "npm run build"
13
- },
14
- "repository": {
15
- "type": "git",
16
- "url": "git+https://github.com/winstonjs/logform.git"
17
- },
18
- "keywords": [
19
- "winston",
20
- "logging",
21
- "format",
22
- "winstonjs"
23
- ],
24
- "author": "Charlie Robbins <charlie.robbins@gmail.com>",
25
- "license": "MIT",
26
- "bugs": {
27
- "url": "https://github.com/winstonjs/logform/issues"
28
- },
29
- "homepage": "https://github.com/winstonjs/logform#readme",
30
- "dependencies": {
31
- "colors": "^1.2.1",
32
- "fast-safe-stringify": "^2.0.4",
33
- "fecha": "^2.3.3",
34
- "ms": "^2.1.1",
35
- "triple-beam": "^1.2.0"
36
- },
37
- "devDependencies": {
38
- "assume": "^2.0.1",
39
- "babel-cli": "^6.26.0",
40
- "babel-preset-env": "^1.7.0",
41
- "eslint-config-populist": "^4.1.0",
42
- "mocha": "^5.1.1",
43
- "nyc": "^11.7.1",
44
- "rimraf": "^2.6.2"
45
- },
46
- "types": "./index.d.ts"
47
-
48
- ,"_resolved": "https://registry.npmjs.org/logform/-/logform-1.10.0.tgz"
49
- ,"_integrity": "sha512-em5ojIhU18fIMOw/333mD+ZLE2fis0EzXl1ZwHx4iQzmpQi6odNiY/t+ITNr33JZhT9/KEaH+UPIipr6a9EjWg=="
50
- ,"_from": "logform@1.10.0"
51
- }
@@ -1,83 +0,0 @@
1
- /* eslint no-unused-vars: 0 */
2
- 'use strict';
3
-
4
- const { configs, LEVEL, MESSAGE } = require('triple-beam');
5
-
6
- class Padder {
7
- constructor(opts = { levels: configs.npm.levels }) {
8
- this.paddings = Padder.paddingForLevels(opts.levels, opts.filler);
9
- this.options = opts;
10
- }
11
-
12
- /**
13
- * Returns the maximum length of keys in the specified `levels` Object.
14
- * @param {Object} levels Set of all levels to calculate longest level against.
15
- * @returns {Number} Maximum length of the longest level string.
16
- */
17
- static getLongestLevel(levels) {
18
- const lvls = Object.keys(levels).map(level => level.length);
19
- return Math.max(...lvls);
20
- }
21
-
22
- /**
23
- * Returns the padding for the specified `level` assuming that the
24
- * maximum length of all levels it's associated with is `maxLength`.
25
- * @param {String} level Level to calculate padding for.
26
- * @param {String} filler Repeatable text to use for padding.
27
- * @param {Number} maxLength Length of the longest level
28
- * @returns {String} Padding string for the `level`
29
- */
30
- static paddingForLevel(level, filler, maxLength) {
31
- const targetLen = maxLength + 1 - level.length;
32
- const rep = Math.floor(targetLen / filler.length);
33
- const padding = `${filler}${filler.repeat(rep)}`;
34
- return padding.slice(0, targetLen);
35
- }
36
-
37
- /**
38
- * Returns an object with the string paddings for the given `levels`
39
- * using the specified `filler`.
40
- * @param {Object} levels Set of all levels to calculate padding for.
41
- * @param {String} filler Repeatable text to use for padding.
42
- * @returns {Object} Mapping of level to desired padding.
43
- */
44
- static paddingForLevels(levels, filler = ' ') {
45
- const maxLength = Padder.getLongestLevel(levels);
46
- return Object.keys(levels).reduce((acc, level) => {
47
- acc[level] = Padder.paddingForLevel(level, filler, maxLength);
48
- return acc;
49
- }, {});
50
- }
51
-
52
- /**
53
- * Prepends the padding onto the `message` based on the `LEVEL` of
54
- * the `info`. This is based on the behavior of `winston@2` which also
55
- * prepended the level onto the message.
56
- *
57
- * See: https://github.com/winstonjs/winston/blob/2.x/lib/winston/logger.js#L198-L201
58
- *
59
- * @param {Info} info Logform info object
60
- * @param {Object} opts Options passed along to this instance.
61
- * @returns {Info} Modified logform info object.
62
- */
63
- transform(info, opts) {
64
- info.message = `${this.paddings[info[LEVEL]]}${info.message}`;
65
- if (info[MESSAGE]) {
66
- info[MESSAGE] = `${this.paddings[info[LEVEL]]}${info[MESSAGE]}`;
67
- }
68
-
69
- return info;
70
- }
71
- }
72
-
73
- /*
74
- * function padLevels (info)
75
- * Returns a new instance of the padLevels Format which pads
76
- * levels to be the same length. This was previously exposed as
77
- * { padLevels: true } to transports in `winston < 3.0.0`.
78
- */
79
- module.exports = opts => new Padder(opts);
80
-
81
- module.exports.Padder
82
- = module.exports.Format
83
- = Padder;
@@ -1,16 +0,0 @@
1
- 'use strict';
2
-
3
- const inspect = require('util').inspect;
4
- const format = require('./format');
5
- const { MESSAGE } = require('triple-beam');
6
-
7
- /*
8
- * function prettyPrint (info)
9
- * Returns a new instance of the prettyPrint Format that "prettyPrint"
10
- * serializes `info` objects. This was previously exposed as
11
- * { prettyPrint: true } to transports in `winston < 3.0.0`.
12
- */
13
- module.exports = format((info, opts) => {
14
- info[MESSAGE] = inspect(info, false, opts.depth || null, opts.colorize);
15
- return info;
16
- });
@@ -1,26 +0,0 @@
1
- 'use strict';
2
-
3
- const { MESSAGE } = require('triple-beam');
4
-
5
- class Printf {
6
- constructor(templateFn) {
7
- this.template = templateFn;
8
- }
9
-
10
- transform(info) {
11
- info[MESSAGE] = this.template(info);
12
- return info;
13
- }
14
- }
15
-
16
- /*
17
- * function printf (templateFn)
18
- * Returns a new instance of the printf Format that creates an
19
- * intermediate prototype to store the template string-based formatter
20
- * function.
21
- */
22
- module.exports = opts => new Printf(opts);
23
-
24
- module.exports.Printf
25
- = module.exports.Format
26
- = Printf;
@@ -1,33 +0,0 @@
1
- /* eslint no-undefined: 0 */
2
- 'use strict';
3
-
4
- const format = require('./format');
5
- const { MESSAGE } = require('triple-beam');
6
- const jsonStringify = require('fast-safe-stringify');
7
-
8
- /*
9
- * function simple (info)
10
- * Returns a new instance of the simple format TransformStream
11
- * which writes a simple representation of logs.
12
- *
13
- * const { level, message, splat, ...rest } = info;
14
- *
15
- * ${level}: ${message} if rest is empty
16
- * ${level}: ${message} ${JSON.stringify(rest)} otherwise
17
- */
18
- module.exports = format(info => {
19
- const stringifiedRest = jsonStringify(Object.assign({}, info, {
20
- level: undefined,
21
- message: undefined,
22
- splat: undefined
23
- }));
24
-
25
- const padding = info.padding && info.padding[info.level] || '';
26
- if (stringifiedRest !== '{}') {
27
- info[MESSAGE] = `${info.level}:${padding} ${info.message} ${stringifiedRest}`;
28
- } else {
29
- info[MESSAGE] = `${info.level}:${padding} ${info.message}`;
30
- }
31
-
32
- return info;
33
- });
@@ -1,125 +0,0 @@
1
- 'use strict';
2
-
3
- const util = require('util');
4
- const { SPLAT } = require('triple-beam');
5
-
6
- /**
7
- * Captures the number of format (i.e. %s strings) in a given string.
8
- * Based on `util.format`, see Node.js source:
9
- * https://github.com/nodejs/node/blob/b1c8f15c5f169e021f7c46eb7b219de95fe97603/lib/util.js#L201-L230
10
- * @type {RegExp}
11
- */
12
- const formatRegExp = /%[scdjifoO%]/g;
13
-
14
- /**
15
- * Captures the number of escaped % signs in a format string (i.e. %s strings).
16
- * @type {RegExp}
17
- */
18
- const escapedPercent = /%%/g;
19
-
20
- class Splatter {
21
- constructor(opts) {
22
- this.options = opts;
23
- }
24
-
25
- /**
26
- * Check to see if tokens <= splat.length, assign { splat, meta } into the
27
- * `info` accordingly, and write to this instance.
28
- *
29
- * @param {Info} info Logform info message.
30
- * @param {String[]} tokens Set of string interpolation tokens.
31
- * @returns {Info} Modified info message
32
- * @private
33
- */
34
- _splat(info, tokens) {
35
- const msg = info.message;
36
- const splat = info[SPLAT] || info.splat || [];
37
- const percents = msg.match(escapedPercent);
38
- const escapes = percents && percents.length || 0;
39
-
40
- // The expected splat is the number of tokens minus the number of escapes
41
- // e.g.
42
- // - { expectedSplat: 3 } '%d %s %j'
43
- // - { expectedSplat: 5 } '[%s] %d%% %d%% %s %j'
44
- //
45
- // Any "meta" will be arugments in addition to the expected splat size
46
- // regardless of type. e.g.
47
- //
48
- // logger.log('info', '%d%% %s %j', 100, 'wow', { such: 'js' }, { thisIsMeta: true });
49
- // would result in splat of four (4), but only three (3) are expected. Therefore:
50
- //
51
- // extraSplat = 3 - 4 = -1
52
- // metas = [100, 'wow', { such: 'js' }, { thisIsMeta: true }].splice(-1, -1 * -1);
53
- // splat = [100, 'wow', { such: 'js' }]
54
- const expectedSplat = tokens.length - escapes;
55
- const extraSplat = expectedSplat - splat.length;
56
- const metas = extraSplat < 0
57
- ? splat.splice(extraSplat, -1 * extraSplat)
58
- : [];
59
-
60
- // Now that { splat } has been separated from any potential { meta }. we
61
- // can assign this to the `info` object and write it to our format stream.
62
- if (metas.length === 1) {
63
- info.meta = metas[0];
64
- } else if (metas.length) {
65
- info.meta = metas;
66
- }
67
-
68
- info.message = util.format(msg, ...splat);
69
- return info;
70
- }
71
-
72
- /**
73
- * Transforms the `info` message by using `util.format` to complete
74
- * any `info.message` provided it has string interpolation tokens.
75
- * If no tokens exist then `info` is immutable.
76
- *
77
- * @param {Info} info Logform info message.
78
- * @param {Object} opts Options for this instance.
79
- * @returns {Info} Modified info message
80
- */
81
- transform(info) {
82
- const msg = info.message;
83
- const splat = info[SPLAT] || info.splat;
84
-
85
- // No need to process anything if splat is undefined
86
- if (!splat || !splat.length) {
87
- return info;
88
- }
89
-
90
- // Extract tokens, if none available default to empty array to
91
- // ensure consistancy in expected results
92
- const tokens = msg && msg.match && msg.match(formatRegExp);
93
-
94
- // This condition will take care of inputs with info[SPLAT]
95
- // but no tokens present
96
- if (!tokens && (splat || splat.length)) {
97
- const metas = splat.length > 1
98
- ? splat.splice(0)
99
- : splat;
100
-
101
- // Now that { splat } has been separated from any potential { meta }. we
102
- // can assign this to the `info` object and write it to our format stream.
103
- if (metas.length === 1) {
104
- info.meta = metas[0];
105
- } else if (metas.length) {
106
- info.meta = metas;
107
- }
108
- return info;
109
- }
110
-
111
- if (tokens) {
112
- return this._splat(info, tokens);
113
- }
114
-
115
- return info;
116
- }
117
- }
118
-
119
- /*
120
- * function splat (info)
121
- * Returns a new instance of the splat format TransformStream
122
- * which performs string interpolation from `info` objects. This was
123
- * previously exposed implicitly in `winston < 3.0.0`.
124
- */
125
- module.exports = opts => new Splatter(opts);
@@ -1,30 +0,0 @@
1
- 'use strict';
2
-
3
- const fecha = require('fecha');
4
- const format = require('./format');
5
-
6
- /*
7
- * function timestamp (info)
8
- * Returns a new instance of the timestamp Format which adds a timestamp
9
- * to the info. It was previously available in winston < 3.0.0 as:
10
- *
11
- * - { timestamp: true } // `new Date.toISOString()`
12
- * - { timestamp: function:String } // Value returned by `timestamp()`
13
- */
14
- module.exports = format((info, opts) => {
15
- if (opts.format) {
16
- info.timestamp = typeof opts.format === 'function'
17
- ? opts.format()
18
- : fecha.format(new Date(), opts.format);
19
- }
20
-
21
- if (!info.timestamp) {
22
- info.timestamp = new Date().toISOString();
23
- }
24
-
25
- if (opts.alias) {
26
- info[opts.alias] = info.timestamp;
27
- }
28
-
29
- return info;
30
- });
@@ -1,22 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "module": "commonjs",
4
- "lib": [
5
- "es6"
6
- ],
7
- "noImplicitAny": true,
8
- "noImplicitThis": true,
9
- "strictNullChecks": true,
10
- "strictFunctionTypes": true,
11
- "baseUrl": "../",
12
- "typeRoots": [
13
- "../"
14
- ],
15
- "types": [],
16
- "noEmit": true,
17
- "forceConsistentCasingInFileNames": true
18
- },
19
- "files": [
20
- "index.d.ts"
21
- ]
22
- }