@contrast/agent 4.32.10 → 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 (228) hide show
  1. package/bin/VERSION +1 -1
  2. package/bin/contrast-service-darwin-arm64 +0 -0
  3. package/bin/contrast-service-darwin-x64 +0 -0
  4. package/bin/contrast-service-linux-arm64 +0 -0
  5. package/bin/contrast-service-linux-x64 +0 -0
  6. package/bin/contrast-service-win32-x64.exe +0 -0
  7. package/node_modules/file-stream-rotator/FileStreamRotator.js +200 -41
  8. package/node_modules/file-stream-rotator/LICENSE.txt +17 -0
  9. package/node_modules/file-stream-rotator/README.md +16 -1
  10. package/node_modules/file-stream-rotator/package.json +5 -5
  11. package/node_modules/file-stream-rotator/tests/every-minute-test.js +32 -15
  12. package/node_modules/file-stream-rotator/tests/every-second-test.js +16 -7
  13. package/node_modules/file-stream-rotator/tests/large-test.js +33 -0
  14. package/node_modules/file-stream-rotator/tests/rotate-on-size-without-date.js +103 -0
  15. package/node_modules/object-hash/dist/object_hash.js +1 -2
  16. package/node_modules/object-hash/index.js +33 -21
  17. package/node_modules/object-hash/package.json +20 -18
  18. package/node_modules/object-hash/readme.markdown +20 -5
  19. package/node_modules/winston-daily-rotate-file/README.md +81 -12
  20. package/node_modules/winston-daily-rotate-file/daily-rotate-file.js +69 -30
  21. package/node_modules/winston-daily-rotate-file/index.d.ts +119 -72
  22. package/node_modules/winston-daily-rotate-file/package.json +20 -19
  23. package/node_modules/winston-transport/.eslintrc +1 -1
  24. package/node_modules/winston-transport/.nyc_output/c3d7ddb9-cc26-466b-a4f6-993ad69e86f6.json +1 -0
  25. package/node_modules/winston-transport/.nyc_output/processinfo/c3d7ddb9-cc26-466b-a4f6-993ad69e86f6.json +1 -0
  26. package/node_modules/winston-transport/.nyc_output/processinfo/index.json +1 -1
  27. package/node_modules/winston-transport/CHANGELOG.md +11 -0
  28. package/node_modules/winston-transport/dist/index.js +2 -2
  29. package/node_modules/winston-transport/index.d.ts +2 -0
  30. package/node_modules/winston-transport/index.js +2 -2
  31. package/node_modules/winston-transport/node_modules/readable-stream/README.md +106 -0
  32. package/node_modules/winston-transport/node_modules/readable-stream/errors-browser.js +127 -0
  33. package/node_modules/winston-transport/node_modules/readable-stream/errors.js +116 -0
  34. package/node_modules/winston-transport/node_modules/readable-stream/experimentalWarning.js +17 -0
  35. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_duplex.js +41 -46
  36. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_passthrough.js +1 -11
  37. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_readable.js +271 -263
  38. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_transform.js +18 -42
  39. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_writable.js +101 -147
  40. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/async_iterator.js +180 -0
  41. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/buffer_list.js +183 -0
  42. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/destroy.js +96 -0
  43. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +86 -0
  44. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/from-browser.js +3 -0
  45. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/from.js +52 -0
  46. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/pipeline.js +86 -0
  47. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/state.js +22 -0
  48. package/node_modules/winston-transport/node_modules/readable-stream/package.json +72 -0
  49. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/readable-browser.js +2 -0
  50. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/readable.js +5 -8
  51. package/node_modules/winston-transport/package.json +16 -14
  52. package/package.json +6 -6
  53. package/node_modules/colors/LICENSE +0 -25
  54. package/node_modules/colors/README.md +0 -221
  55. package/node_modules/colors/examples/normal-usage.js +0 -82
  56. package/node_modules/colors/examples/safe-string.js +0 -79
  57. package/node_modules/colors/index.d.ts +0 -136
  58. package/node_modules/colors/lib/colors.js +0 -211
  59. package/node_modules/colors/lib/custom/trap.js +0 -46
  60. package/node_modules/colors/lib/custom/zalgo.js +0 -110
  61. package/node_modules/colors/lib/extendStringPrototype.js +0 -110
  62. package/node_modules/colors/lib/index.js +0 -13
  63. package/node_modules/colors/lib/maps/america.js +0 -10
  64. package/node_modules/colors/lib/maps/rainbow.js +0 -12
  65. package/node_modules/colors/lib/maps/random.js +0 -11
  66. package/node_modules/colors/lib/maps/zebra.js +0 -5
  67. package/node_modules/colors/lib/styles.js +0 -95
  68. package/node_modules/colors/lib/system/has-flag.js +0 -35
  69. package/node_modules/colors/lib/system/supports-colors.js +0 -151
  70. package/node_modules/colors/package.json +0 -49
  71. package/node_modules/colors/safe.d.ts +0 -48
  72. package/node_modules/colors/safe.js +0 -10
  73. package/node_modules/colors/themes/generic-logging.js +0 -12
  74. package/node_modules/core-util-is/LICENSE +0 -19
  75. package/node_modules/core-util-is/README.md +0 -3
  76. package/node_modules/core-util-is/float.patch +0 -604
  77. package/node_modules/core-util-is/lib/util.js +0 -107
  78. package/node_modules/core-util-is/package.json +0 -36
  79. package/node_modules/core-util-is/test.js +0 -68
  80. package/node_modules/cycle/README.md +0 -49
  81. package/node_modules/cycle/cycle.js +0 -170
  82. package/node_modules/cycle/package.json +0 -16
  83. package/node_modules/fast-safe-stringify/.travis.yml +0 -8
  84. package/node_modules/fast-safe-stringify/CHANGELOG.md +0 -17
  85. package/node_modules/fast-safe-stringify/LICENSE +0 -23
  86. package/node_modules/fast-safe-stringify/benchmark.js +0 -137
  87. package/node_modules/fast-safe-stringify/index.d.ts +0 -8
  88. package/node_modules/fast-safe-stringify/index.js +0 -161
  89. package/node_modules/fast-safe-stringify/package.json +0 -50
  90. package/node_modules/fast-safe-stringify/readme.md +0 -154
  91. package/node_modules/fast-safe-stringify/test-stable.js +0 -311
  92. package/node_modules/fast-safe-stringify/test.js +0 -304
  93. package/node_modules/isarray/.npmignore +0 -1
  94. package/node_modules/isarray/.travis.yml +0 -4
  95. package/node_modules/isarray/Makefile +0 -6
  96. package/node_modules/isarray/README.md +0 -60
  97. package/node_modules/isarray/component.json +0 -19
  98. package/node_modules/isarray/index.js +0 -5
  99. package/node_modules/isarray/package.json +0 -49
  100. package/node_modules/isarray/test.js +0 -20
  101. package/node_modules/object-hash/.jshintrc +0 -19
  102. package/node_modules/object-hash/.travis.yml +0 -35
  103. package/node_modules/object-hash/bower.json +0 -15
  104. package/node_modules/object-hash/dist/object_hash.js.map +0 -1
  105. package/node_modules/object-hash/dist/object_hash_test.js +0 -4737
  106. package/node_modules/object-hash/gulpfile.js +0 -97
  107. package/node_modules/object-hash/karma.conf.js +0 -69
  108. package/node_modules/object-hash/test/blob.js +0 -41
  109. package/node_modules/object-hash/test/index.js +0 -290
  110. package/node_modules/object-hash/test/object-classes.js +0 -106
  111. package/node_modules/object-hash/test/old-crypto.js +0 -60
  112. package/node_modules/object-hash/test/replacer.js +0 -36
  113. package/node_modules/object-hash/test/types.js +0 -174
  114. package/node_modules/object-hash/test/writeToStream.js +0 -27
  115. package/node_modules/process-nextick-args/index.js +0 -45
  116. package/node_modules/process-nextick-args/license.md +0 -19
  117. package/node_modules/process-nextick-args/package.json +0 -29
  118. package/node_modules/process-nextick-args/readme.md +0 -18
  119. package/node_modules/readable-stream/.travis.yml +0 -34
  120. package/node_modules/readable-stream/README.md +0 -58
  121. package/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +0 -60
  122. package/node_modules/readable-stream/duplex-browser.js +0 -1
  123. package/node_modules/readable-stream/duplex.js +0 -1
  124. package/node_modules/readable-stream/lib/internal/streams/BufferList.js +0 -79
  125. package/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -74
  126. package/node_modules/readable-stream/package.json +0 -56
  127. package/node_modules/readable-stream/passthrough.js +0 -1
  128. package/node_modules/readable-stream/transform.js +0 -1
  129. package/node_modules/readable-stream/writable-browser.js +0 -1
  130. package/node_modules/readable-stream/writable.js +0 -8
  131. package/node_modules/winston-compat/.gitattributes +0 -1
  132. package/node_modules/winston-compat/.node-version +0 -1
  133. package/node_modules/winston-compat/CHANGELOG.md +0 -17
  134. package/node_modules/winston-compat/LICENSE +0 -22
  135. package/node_modules/winston-compat/README.md +0 -2
  136. package/node_modules/winston-compat/index.js +0 -295
  137. package/node_modules/winston-compat/lib/transport.js +0 -135
  138. package/node_modules/winston-compat/node_modules/fecha/CHANGELOG.md +0 -11
  139. package/node_modules/winston-compat/node_modules/fecha/LICENSE +0 -22
  140. package/node_modules/winston-compat/node_modules/fecha/README.md +0 -259
  141. package/node_modules/winston-compat/node_modules/fecha/fecha.d.ts +0 -47
  142. package/node_modules/winston-compat/node_modules/fecha/fecha.js +0 -334
  143. package/node_modules/winston-compat/node_modules/fecha/fecha.min.js +0 -1
  144. package/node_modules/winston-compat/node_modules/fecha/package.json +0 -44
  145. package/node_modules/winston-compat/node_modules/logform/.babelrc +0 -3
  146. package/node_modules/winston-compat/node_modules/logform/.eslintrc +0 -7
  147. package/node_modules/winston-compat/node_modules/logform/.gitattributes +0 -1
  148. package/node_modules/winston-compat/node_modules/logform/.travis.yml +0 -17
  149. package/node_modules/winston-compat/node_modules/logform/CHANGELOG.md +0 -103
  150. package/node_modules/winston-compat/node_modules/logform/LICENSE +0 -21
  151. package/node_modules/winston-compat/node_modules/logform/README.md +0 -170
  152. package/node_modules/winston-compat/node_modules/logform/align.js +0 -14
  153. package/node_modules/winston-compat/node_modules/logform/browser.js +0 -36
  154. package/node_modules/winston-compat/node_modules/logform/cli.js +0 -52
  155. package/node_modules/winston-compat/node_modules/logform/colorize.js +0 -118
  156. package/node_modules/winston-compat/node_modules/logform/combine.js +0 -66
  157. package/node_modules/winston-compat/node_modules/logform/dist/align.js +0 -14
  158. package/node_modules/winston-compat/node_modules/logform/dist/browser.js +0 -37
  159. package/node_modules/winston-compat/node_modules/logform/dist/cli.js +0 -75
  160. package/node_modules/winston-compat/node_modules/logform/dist/colorize.js +0 -147
  161. package/node_modules/winston-compat/node_modules/logform/dist/combine.js +0 -66
  162. package/node_modules/winston-compat/node_modules/logform/dist/format.js +0 -69
  163. package/node_modules/winston-compat/node_modules/logform/dist/index.js +0 -54
  164. package/node_modules/winston-compat/node_modules/logform/dist/json.js +0 -27
  165. package/node_modules/winston-compat/node_modules/logform/dist/label.js +0 -19
  166. package/node_modules/winston-compat/node_modules/logform/dist/levels.js +0 -15
  167. package/node_modules/winston-compat/node_modules/logform/dist/logstash.js +0 -32
  168. package/node_modules/winston-compat/node_modules/logform/dist/metadata.js +0 -63
  169. package/node_modules/winston-compat/node_modules/logform/dist/ms.js +0 -18
  170. package/node_modules/winston-compat/node_modules/logform/dist/pad-levels.js +0 -118
  171. package/node_modules/winston-compat/node_modules/logform/dist/pretty-print.js +0 -20
  172. package/node_modules/winston-compat/node_modules/logform/dist/printf.js +0 -40
  173. package/node_modules/winston-compat/node_modules/logform/dist/simple.js +0 -36
  174. package/node_modules/winston-compat/node_modules/logform/dist/splat.js +0 -147
  175. package/node_modules/winston-compat/node_modules/logform/dist/timestamp.js +0 -28
  176. package/node_modules/winston-compat/node_modules/logform/dist/uncolorize.js +0 -31
  177. package/node_modules/winston-compat/node_modules/logform/examples/combine.js +0 -14
  178. package/node_modules/winston-compat/node_modules/logform/examples/filter.js +0 -30
  179. package/node_modules/winston-compat/node_modules/logform/examples/invalid.js +0 -6
  180. package/node_modules/winston-compat/node_modules/logform/examples/metadata.js +0 -78
  181. package/node_modules/winston-compat/node_modules/logform/examples/padLevels.js +0 -39
  182. package/node_modules/winston-compat/node_modules/logform/examples/volume.js +0 -25
  183. package/node_modules/winston-compat/node_modules/logform/format.js +0 -52
  184. package/node_modules/winston-compat/node_modules/logform/index.d.ts +0 -53
  185. package/node_modules/winston-compat/node_modules/logform/index.js +0 -52
  186. package/node_modules/winston-compat/node_modules/logform/json.js +0 -26
  187. package/node_modules/winston-compat/node_modules/logform/label.js +0 -19
  188. package/node_modules/winston-compat/node_modules/logform/levels.js +0 -12
  189. package/node_modules/winston-compat/node_modules/logform/logstash.js +0 -29
  190. package/node_modules/winston-compat/node_modules/logform/metadata.js +0 -61
  191. package/node_modules/winston-compat/node_modules/logform/ms.js +0 -18
  192. package/node_modules/winston-compat/node_modules/logform/package.json +0 -51
  193. package/node_modules/winston-compat/node_modules/logform/pad-levels.js +0 -83
  194. package/node_modules/winston-compat/node_modules/logform/pretty-print.js +0 -16
  195. package/node_modules/winston-compat/node_modules/logform/printf.js +0 -26
  196. package/node_modules/winston-compat/node_modules/logform/simple.js +0 -33
  197. package/node_modules/winston-compat/node_modules/logform/splat.js +0 -125
  198. package/node_modules/winston-compat/node_modules/logform/timestamp.js +0 -30
  199. package/node_modules/winston-compat/node_modules/logform/tsconfig.json +0 -22
  200. package/node_modules/winston-compat/node_modules/logform/uncolorize.js +0 -27
  201. package/node_modules/winston-compat/package.json +0 -46
  202. package/node_modules/winston-compat/test/clone.test.js +0 -25
  203. package/node_modules/winston-compat/test/helpers.js +0 -256
  204. package/node_modules/winston-compat/test/timestamp.test.js +0 -14
  205. package/node_modules/winston-compat/test/transports/transport.js +0 -205
  206. package/node_modules/winston-compat/test/winston-compat.test.js +0 -18
  207. package/node_modules/winston-daily-rotate-file/.eslintrc.js +0 -11
  208. package/node_modules/winston-daily-rotate-file/.node-version +0 -1
  209. package/node_modules/winston-daily-rotate-file/.travis.yml +0 -15
  210. package/node_modules/winston-daily-rotate-file/node_modules/semver/CHANGELOG.md +0 -70
  211. package/node_modules/winston-daily-rotate-file/node_modules/semver/LICENSE +0 -15
  212. package/node_modules/winston-daily-rotate-file/node_modules/semver/README.md +0 -443
  213. package/node_modules/winston-daily-rotate-file/node_modules/semver/bin/semver.js +0 -174
  214. package/node_modules/winston-daily-rotate-file/node_modules/semver/package.json +0 -32
  215. package/node_modules/winston-daily-rotate-file/node_modules/semver/range.bnf +0 -16
  216. package/node_modules/winston-daily-rotate-file/node_modules/semver/semver.js +0 -1596
  217. package/node_modules/winston-daily-rotate-file/test/memory-stream.js +0 -38
  218. package/node_modules/winston-daily-rotate-file/test/random-string.js +0 -31
  219. package/node_modules/winston-daily-rotate-file/test/transport-tests.js +0 -250
  220. package/node_modules/winston-transport/.nyc_output/1c69f3e4-4c25-457d-9df5-dfa761729528.json +0 -1
  221. package/node_modules/winston-transport/.nyc_output/processinfo/1c69f3e4-4c25-457d-9df5-dfa761729528.json +0 -1
  222. package/node_modules/winston-transport/.travis.yml +0 -17
  223. package/node_modules/winston-transport/tsconfig.json +0 -22
  224. /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/CONTRIBUTING.md +0 -0
  225. /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/GOVERNANCE.md +0 -0
  226. /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/LICENSE +0 -0
  227. /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/internal/streams/stream-browser.js +0 -0
  228. /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/internal/streams/stream.js +0 -0
@@ -1,75 +0,0 @@
1
- 'use strict';
2
-
3
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
4
-
5
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
-
7
- var _require = require('./colorize'),
8
- Colorizer = _require.Colorizer;
9
-
10
- var _require2 = require('./pad-levels'),
11
- Padder = _require2.Padder;
12
-
13
- var _require3 = require('triple-beam'),
14
- configs = _require3.configs,
15
- MESSAGE = _require3.MESSAGE;
16
-
17
- /**
18
- * Cli format class that handles initial state for a a separate
19
- * Colorizer and Padder instance.
20
- */
21
-
22
-
23
- var CliFormat = function () {
24
- function CliFormat() {
25
- var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
26
-
27
- _classCallCheck(this, CliFormat);
28
-
29
- if (!opts.levels) {
30
- opts.levels = configs.npm.levels;
31
- }
32
-
33
- this.colorizer = new Colorizer(opts);
34
- this.padder = new Padder(opts);
35
- this.options = opts;
36
- }
37
-
38
- /*
39
- * function transform (info, opts)
40
- * Attempts to both:
41
- * 1. Pad the { level }
42
- * 2. Colorize the { level, message }
43
- * of the given `logform` info object depending on the `opts`.
44
- */
45
-
46
-
47
- _createClass(CliFormat, [{
48
- key: 'transform',
49
- value: function transform(info, opts) {
50
- this.colorizer.transform(this.padder.transform(info, opts), opts);
51
-
52
- info[MESSAGE] = info.level + ':' + info.message;
53
- return info;
54
- }
55
- }]);
56
-
57
- return CliFormat;
58
- }();
59
-
60
- /*
61
- * function cli (opts)
62
- * Returns a new instance of the CLI format that turns a log
63
- * `info` object into the same format previously available
64
- * in `winston.cli()` in `winston < 3.0.0`.
65
- */
66
-
67
-
68
- module.exports = function (opts) {
69
- return new CliFormat(opts);
70
- };
71
-
72
- //
73
- // Attach the CliFormat for registration purposes
74
- //
75
- module.exports.Format = CliFormat;
@@ -1,147 +0,0 @@
1
- 'use strict';
2
-
3
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
4
-
5
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
-
7
- var colors = require('colors/safe');
8
-
9
- var _require = require('triple-beam'),
10
- LEVEL = _require.LEVEL;
11
-
12
- //
13
- // Fix colors not appearing in non-tty environments
14
- //
15
-
16
-
17
- colors.enabled = true;
18
-
19
- /**
20
- * @property {RegExp} hasSpace
21
- * Simple regex to check for presence of spaces.
22
- */
23
- var hasSpace = /\s+/;
24
-
25
- /*
26
- * Colorizer format. Wraps the `level` and/or `message` properties
27
- * of the `info` objects with ANSI color codes based on a few options.
28
- */
29
-
30
- var Colorizer = function () {
31
- function Colorizer() {
32
- var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
33
-
34
- _classCallCheck(this, Colorizer);
35
-
36
- if (opts.colors) {
37
- this.addColors(opts.colors);
38
- }
39
-
40
- this.options = opts;
41
- }
42
-
43
- /*
44
- * Adds the colors Object to the set of allColors
45
- * known by the Colorizer
46
- *
47
- * @param {Object} colors Set of color mappings to add.
48
- */
49
-
50
-
51
- _createClass(Colorizer, [{
52
- key: 'addColors',
53
-
54
-
55
- /*
56
- * Adds the colors Object to the set of allColors
57
- * known by the Colorizer
58
- *
59
- * @param {Object} colors Set of color mappings to add.
60
- */
61
- value: function addColors(clrs) {
62
- return Colorizer.addColors(clrs);
63
- }
64
-
65
- /*
66
- * function colorize (lookup, level, message)
67
- * Performs multi-step colorization using colors/safe
68
- */
69
-
70
- }, {
71
- key: 'colorize',
72
- value: function colorize(lookup, level, message) {
73
- if (typeof message === 'undefined') {
74
- message = level;
75
- }
76
-
77
- //
78
- // If the color for the level is just a string
79
- // then attempt to colorize the message with it.
80
- //
81
- if (!Array.isArray(Colorizer.allColors[lookup])) {
82
- return colors[Colorizer.allColors[lookup]](message);
83
- }
84
-
85
- //
86
- // If it is an Array then iterate over that Array, applying
87
- // the colors function for each item.
88
- //
89
- for (var i = 0, len = Colorizer.allColors[lookup].length; i < len; i++) {
90
- message = colors[Colorizer.allColors[lookup][i]](message);
91
- }
92
-
93
- return message;
94
- }
95
-
96
- /*
97
- * function transform (info, opts)
98
- * Attempts to colorize the { level, message } of the given
99
- * `logform` info object.
100
- */
101
-
102
- }, {
103
- key: 'transform',
104
- value: function transform(info, opts) {
105
- if (opts.level || opts.all || !opts.message) {
106
- info.level = this.colorize(info[LEVEL], info.level);
107
- }
108
-
109
- if (opts.all || opts.message) {
110
- info.message = this.colorize(info[LEVEL], info.level, info.message);
111
- }
112
-
113
- return info;
114
- }
115
- }], [{
116
- key: 'addColors',
117
- value: function addColors(clrs) {
118
- var nextColors = Object.keys(clrs).reduce(function (acc, level) {
119
- acc[level] = hasSpace.test(clrs[level]) ? clrs[level].split(hasSpace) : clrs[level];
120
-
121
- return acc;
122
- }, {});
123
-
124
- Colorizer.allColors = Object.assign({}, Colorizer.allColors || {}, nextColors);
125
- return Colorizer.allColors;
126
- }
127
- }]);
128
-
129
- return Colorizer;
130
- }();
131
-
132
- /*
133
- * function colorize (info)
134
- * Returns a new instance of the colorize Format that applies
135
- * level colors to `info` objects. This was previously exposed
136
- * as { colorize: true } to transports in `winston < 3.0.0`.
137
- */
138
-
139
-
140
- module.exports = function (opts) {
141
- return new Colorizer(opts);
142
- };
143
-
144
- //
145
- // Attach the Colorizer for registration purposes
146
- //
147
- module.exports.Colorizer = module.exports.Format = Colorizer;
@@ -1,66 +0,0 @@
1
- 'use strict';
2
-
3
- var format = require('./format');
4
-
5
- /*
6
- * function cascade(formats)
7
- * Returns a function that invokes the `._format` function in-order
8
- * for the specified set of `formats`. In this manner we say that Formats
9
- * are "pipe-like", but not a pure pumpify implementation. Since there is no back
10
- * pressure we can remove all of the "readable" plumbing in Node streams.
11
- */
12
- function cascade(formats) {
13
- if (!formats.every(isValidFormat)) {
14
- return;
15
- }
16
-
17
- return function (info) {
18
- var obj = info;
19
- for (var i = 0; i < formats.length; i++) {
20
- obj = formats[i].transform(obj, formats[i].options);
21
- if (!obj) {
22
- return false;
23
- }
24
- }
25
-
26
- return obj;
27
- };
28
- }
29
-
30
- /*
31
- * function isValidFormat(format)
32
- * If the format does not define a `transform` function throw an error
33
- * with more detailed usage.
34
- */
35
- function isValidFormat(fmt) {
36
- if (typeof fmt.transform !== 'function') {
37
- throw new Error(['No transform function found on format. Did you create a format instance?', 'const myFormat = format(formatFn);', 'const instance = myFormat();'].join('\n'));
38
- }
39
-
40
- return true;
41
- }
42
-
43
- /*
44
- * function combine (info)
45
- * Returns a new instance of the combine Format which combines the specified
46
- * formats into a new format. This is similar to a pipe-chain in transform streams.
47
- * We choose to combine the prototypes this way because there is no back pressure in
48
- * an in-memory transform chain.
49
- */
50
- module.exports = function () {
51
- for (var _len = arguments.length, formats = Array(_len), _key = 0; _key < _len; _key++) {
52
- formats[_key] = arguments[_key];
53
- }
54
-
55
- var combinedFormat = format(cascade(formats));
56
- var instance = combinedFormat();
57
- instance.Format = combinedFormat.Format;
58
- return instance;
59
- };
60
-
61
- //
62
- // Export the cascade method for use in cli and other
63
- // combined formats that should not be assumed to be
64
- // singletons.
65
- //
66
- module.exports.cascade = cascade;
@@ -1,69 +0,0 @@
1
- 'use strict';
2
-
3
- /*
4
- * Displays a helpful message and the source of
5
- * the format when it is invalid.
6
- */
7
-
8
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9
-
10
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
11
-
12
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
13
-
14
- var InvalidFormatError = function (_Error) {
15
- _inherits(InvalidFormatError, _Error);
16
-
17
- function InvalidFormatError(formatFn) {
18
- _classCallCheck(this, InvalidFormatError);
19
-
20
- var _this = _possibleConstructorReturn(this, (InvalidFormatError.__proto__ || Object.getPrototypeOf(InvalidFormatError)).call(this, 'Format functions must be synchronous taking a two arguments: (info, opts)\nFound: ' + formatFn.toString().split('\n')[0] + '\n'));
21
-
22
- Error.captureStackTrace(_this, InvalidFormatError);
23
- return _this;
24
- }
25
-
26
- return InvalidFormatError;
27
- }(Error);
28
-
29
- /*
30
- * function format (formatFn)
31
- * Returns a create function for the `formatFn`.
32
- */
33
-
34
-
35
- module.exports = function (formatFn) {
36
- if (formatFn.length > 2) {
37
- throw new InvalidFormatError(formatFn);
38
- }
39
-
40
- /*
41
- * function Format (options)
42
- * Base prototype which calls a `_format`
43
- * function and pushes the result.
44
- */
45
- function Format() {
46
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
47
-
48
- this.options = options;
49
- }
50
-
51
- Format.prototype.transform = formatFn;
52
-
53
- //
54
- // Create a function which returns new instances of
55
- // FormatWrap for simple syntax like:
56
- //
57
- // require('winston').formats.json();
58
- //
59
- function createFormatWrap(opts) {
60
- return new Format(opts);
61
- }
62
-
63
- //
64
- // Expose the FormatWrap through the create function
65
- // for testability.
66
- //
67
- createFormatWrap.Format = Format;
68
- return createFormatWrap;
69
- };
@@ -1,54 +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
-
10
- var format = exports.format = require('./format');
11
-
12
- /*
13
- * @api public
14
- * @method {function} levels
15
- * Registers the specified levels with logform.
16
- */
17
- exports.levels = require('./levels');
18
-
19
- /*
20
- * @api private
21
- * method {function} exposeFormat
22
- * Exposes a sub-format on the main format object
23
- * as a lazy-loaded getter.
24
- */
25
- function exposeFormat(name, path) {
26
- path = path || name;
27
- Object.defineProperty(format, name, {
28
- get: function get() {
29
- return require('./' + path + '.js');
30
- },
31
-
32
- configurable: true
33
- });
34
- }
35
-
36
- //
37
- // Setup all transports as lazy-loaded getters.
38
- //
39
- exposeFormat('align');
40
- exposeFormat('cli');
41
- exposeFormat('combine');
42
- exposeFormat('colorize');
43
- exposeFormat('json');
44
- exposeFormat('label');
45
- exposeFormat('logstash');
46
- exposeFormat('metadata');
47
- exposeFormat('ms');
48
- exposeFormat('padLevels', 'pad-levels');
49
- exposeFormat('prettyPrint', 'pretty-print');
50
- exposeFormat('printf');
51
- exposeFormat('simple');
52
- exposeFormat('splat');
53
- exposeFormat('timestamp');
54
- exposeFormat('uncolorize');
@@ -1,27 +0,0 @@
1
- 'use strict';
2
-
3
- var format = require('./format');
4
-
5
- var _require = require('triple-beam'),
6
- MESSAGE = _require.MESSAGE;
7
-
8
- var jsonStringify = require('fast-safe-stringify');
9
-
10
- /*
11
- * function replacer (key, value)
12
- * Handles proper stringification of Buffer output.
13
- */
14
- function replacer(key, value) {
15
- return value instanceof Buffer ? value.toString('base64') : value;
16
- }
17
-
18
- /*
19
- * function json (info)
20
- * Returns a new instance of the JSON format that turns a log `info`
21
- * object into pure JSON. This was previously exposed as { json: true }
22
- * to transports in `winston < 3.0.0`.
23
- */
24
- module.exports = format(function (info, opts) {
25
- info[MESSAGE] = jsonStringify(info, opts.replacer || replacer, opts.space);
26
- return info;
27
- });
@@ -1,19 +0,0 @@
1
- 'use strict';
2
-
3
- var 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(function (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,15 +0,0 @@
1
- 'use strict';
2
-
3
- var _require = require('./colorize'),
4
- Colorizer = _require.Colorizer;
5
-
6
- /*
7
- * Simple method to register colors with a simpler require
8
- * path within the module.
9
- */
10
-
11
-
12
- module.exports = function (config) {
13
- Colorizer.addColors(config.colors || config);
14
- return config;
15
- };
@@ -1,32 +0,0 @@
1
- 'use strict';
2
-
3
- var format = require('./format');
4
-
5
- var _require = require('triple-beam'),
6
- MESSAGE = _require.MESSAGE;
7
-
8
- var jsonStringify = require('fast-safe-stringify');
9
-
10
- /*
11
- * function logstash (info)
12
- * Returns a new instance of the LogStash Format that turns a
13
- * log `info` object into pure JSON with the appropriate logstash
14
- * options. This was previously exposed as { logstash: true }
15
- * to transports in `winston < 3.0.0`.
16
- */
17
- module.exports = format(function (info) {
18
- var logstash = {};
19
- if (info.message) {
20
- logstash['@message'] = info.message;
21
- delete info.message;
22
- }
23
-
24
- if (info.timestamp) {
25
- logstash['@timestamp'] = info.timestamp;
26
- delete info.timestamp;
27
- }
28
-
29
- logstash['@fields'] = info;
30
- info[MESSAGE] = jsonStringify(logstash);
31
- return info;
32
- });
@@ -1,63 +0,0 @@
1
- 'use strict';
2
-
3
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
-
5
- var format = require('./format');
6
-
7
- function fillExcept(info, fillExceptKeys, metadataKey) {
8
- var savedKeys = fillExceptKeys.reduce(function (acc, key) {
9
- acc[key] = info[key];
10
- delete info[key];
11
- return acc;
12
- }, {});
13
- var metadata = Object.keys(info).reduce(function (acc, key) {
14
- acc[key] = info[key];
15
- delete info[key];
16
- return acc;
17
- }, {});
18
-
19
- Object.assign(info, savedKeys, _defineProperty({}, metadataKey, metadata));
20
- return info;
21
- }
22
-
23
- function fillWith(info, fillWithKeys, metadataKey) {
24
- info[metadataKey] = fillWithKeys.reduce(function (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(function (info) {
37
- var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
38
-
39
- var metadataKey = 'metadata';
40
- if (opts.key) {
41
- metadataKey = opts.key;
42
- }
43
-
44
- var fillExceptKeys = [];
45
- if (!opts.fillExcept && !opts.fillWith) {
46
- fillExceptKeys.push('level');
47
- fillExceptKeys.push('message');
48
- }
49
-
50
- if (opts.fillExcept) {
51
- fillExceptKeys = opts.fillExcept;
52
- }
53
-
54
- if (fillExceptKeys.length > 0) {
55
- return fillExcept(info, fillExceptKeys, metadataKey);
56
- }
57
-
58
- if (opts.fillWith) {
59
- return fillWith(info, opts.fillWith, metadataKey);
60
- }
61
-
62
- return info;
63
- });
@@ -1,18 +0,0 @@
1
- 'use strict';
2
-
3
- var format = require('./format');
4
- var 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(function (info) {
12
- var curr = +new Date();
13
- undefined.diff = curr - (undefined.prevTime || curr);
14
- undefined.prevTime = curr;
15
- info.ms = '+' + ms(undefined.diff);
16
-
17
- return info;
18
- });