@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,118 +0,0 @@
1
- /* eslint no-unused-vars: 0 */
2
- 'use strict';
3
-
4
- 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; }; }();
5
-
6
- function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
7
-
8
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9
-
10
- var _require = require('triple-beam'),
11
- configs = _require.configs,
12
- LEVEL = _require.LEVEL,
13
- MESSAGE = _require.MESSAGE;
14
-
15
- var Padder = function () {
16
- function Padder() {
17
- var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { levels: configs.npm.levels };
18
-
19
- _classCallCheck(this, Padder);
20
-
21
- this.paddings = Padder.paddingForLevels(opts.levels, opts.filler);
22
- this.options = opts;
23
- }
24
-
25
- /**
26
- * Returns the maximum length of keys in the specified `levels` Object.
27
- * @param {Object} levels Set of all levels to calculate longest level against.
28
- * @returns {Number} Maximum length of the longest level string.
29
- */
30
-
31
-
32
- _createClass(Padder, [{
33
- key: 'transform',
34
-
35
-
36
- /**
37
- * Prepends the padding onto the `message` based on the `LEVEL` of
38
- * the `info`. This is based on the behavior of `winston@2` which also
39
- * prepended the level onto the message.
40
- *
41
- * See: https://github.com/winstonjs/winston/blob/2.x/lib/winston/logger.js#L198-L201
42
- *
43
- * @param {Info} info Logform info object
44
- * @param {Object} opts Options passed along to this instance.
45
- * @returns {Info} Modified logform info object.
46
- */
47
- value: function transform(info, opts) {
48
- info.message = '' + this.paddings[info[LEVEL]] + info.message;
49
- if (info[MESSAGE]) {
50
- info[MESSAGE] = '' + this.paddings[info[LEVEL]] + info[MESSAGE];
51
- }
52
-
53
- return info;
54
- }
55
- }], [{
56
- key: 'getLongestLevel',
57
- value: function getLongestLevel(levels) {
58
- var lvls = Object.keys(levels).map(function (level) {
59
- return level.length;
60
- });
61
- return Math.max.apply(Math, _toConsumableArray(lvls));
62
- }
63
-
64
- /**
65
- * Returns the padding for the specified `level` assuming that the
66
- * maximum length of all levels it's associated with is `maxLength`.
67
- * @param {String} level Level to calculate padding for.
68
- * @param {String} filler Repeatable text to use for padding.
69
- * @param {Number} maxLength Length of the longest level
70
- * @returns {String} Padding string for the `level`
71
- */
72
-
73
- }, {
74
- key: 'paddingForLevel',
75
- value: function paddingForLevel(level, filler, maxLength) {
76
- var targetLen = maxLength + 1 - level.length;
77
- var rep = Math.floor(targetLen / filler.length);
78
- var padding = '' + filler + filler.repeat(rep);
79
- return padding.slice(0, targetLen);
80
- }
81
-
82
- /**
83
- * Returns an object with the string paddings for the given `levels`
84
- * using the specified `filler`.
85
- * @param {Object} levels Set of all levels to calculate padding for.
86
- * @param {String} filler Repeatable text to use for padding.
87
- * @returns {Object} Mapping of level to desired padding.
88
- */
89
-
90
- }, {
91
- key: 'paddingForLevels',
92
- value: function paddingForLevels(levels) {
93
- var filler = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ' ';
94
-
95
- var maxLength = Padder.getLongestLevel(levels);
96
- return Object.keys(levels).reduce(function (acc, level) {
97
- acc[level] = Padder.paddingForLevel(level, filler, maxLength);
98
- return acc;
99
- }, {});
100
- }
101
- }]);
102
-
103
- return Padder;
104
- }();
105
-
106
- /*
107
- * function padLevels (info)
108
- * Returns a new instance of the padLevels Format which pads
109
- * levels to be the same length. This was previously exposed as
110
- * { padLevels: true } to transports in `winston < 3.0.0`.
111
- */
112
-
113
-
114
- module.exports = function (opts) {
115
- return new Padder(opts);
116
- };
117
-
118
- module.exports.Padder = module.exports.Format = Padder;
@@ -1,20 +0,0 @@
1
- 'use strict';
2
-
3
- var inspect = require('util').inspect;
4
- var format = require('./format');
5
-
6
- var _require = require('triple-beam'),
7
- MESSAGE = _require.MESSAGE;
8
-
9
- /*
10
- * function prettyPrint (info)
11
- * Returns a new instance of the prettyPrint Format that "prettyPrint"
12
- * serializes `info` objects. This was previously exposed as
13
- * { prettyPrint: true } to transports in `winston < 3.0.0`.
14
- */
15
-
16
-
17
- module.exports = format(function (info, opts) {
18
- info[MESSAGE] = inspect(info, false, opts.depth || null, opts.colorize);
19
- return info;
20
- });
@@ -1,40 +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('triple-beam'),
8
- MESSAGE = _require.MESSAGE;
9
-
10
- var Printf = function () {
11
- function Printf(templateFn) {
12
- _classCallCheck(this, Printf);
13
-
14
- this.template = templateFn;
15
- }
16
-
17
- _createClass(Printf, [{
18
- key: 'transform',
19
- value: function transform(info) {
20
- info[MESSAGE] = this.template(info);
21
- return info;
22
- }
23
- }]);
24
-
25
- return Printf;
26
- }();
27
-
28
- /*
29
- * function printf (templateFn)
30
- * Returns a new instance of the printf Format that creates an
31
- * intermediate prototype to store the template string-based formatter
32
- * function.
33
- */
34
-
35
-
36
- module.exports = function (opts) {
37
- return new Printf(opts);
38
- };
39
-
40
- module.exports.Printf = module.exports.Format = Printf;
@@ -1,36 +0,0 @@
1
- /* eslint no-undefined: 0 */
2
- 'use strict';
3
-
4
- var format = require('./format');
5
-
6
- var _require = require('triple-beam'),
7
- MESSAGE = _require.MESSAGE;
8
-
9
- var jsonStringify = require('fast-safe-stringify');
10
-
11
- /*
12
- * function simple (info)
13
- * Returns a new instance of the simple format TransformStream
14
- * which writes a simple representation of logs.
15
- *
16
- * const { level, message, splat, ...rest } = info;
17
- *
18
- * ${level}: ${message} if rest is empty
19
- * ${level}: ${message} ${JSON.stringify(rest)} otherwise
20
- */
21
- module.exports = format(function (info) {
22
- var stringifiedRest = jsonStringify(Object.assign({}, info, {
23
- level: undefined,
24
- message: undefined,
25
- splat: undefined
26
- }));
27
-
28
- var padding = info.padding && info.padding[info.level] || '';
29
- if (stringifiedRest !== '{}') {
30
- info[MESSAGE] = info.level + ':' + padding + ' ' + info.message + ' ' + stringifiedRest;
31
- } else {
32
- info[MESSAGE] = info.level + ':' + padding + ' ' + info.message;
33
- }
34
-
35
- return info;
36
- });
@@ -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 _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
6
-
7
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8
-
9
- var util = require('util');
10
-
11
- var _require = require('triple-beam'),
12
- SPLAT = _require.SPLAT;
13
-
14
- /**
15
- * Captures the number of format (i.e. %s strings) in a given string.
16
- * Based on `util.format`, see Node.js source:
17
- * https://github.com/nodejs/node/blob/b1c8f15c5f169e021f7c46eb7b219de95fe97603/lib/util.js#L201-L230
18
- * @type {RegExp}
19
- */
20
-
21
-
22
- var formatRegExp = /%[scdjifoO%]/g;
23
-
24
- /**
25
- * Captures the number of escaped % signs in a format string (i.e. %s strings).
26
- * @type {RegExp}
27
- */
28
- var escapedPercent = /%%/g;
29
-
30
- var Splatter = function () {
31
- function Splatter(opts) {
32
- _classCallCheck(this, Splatter);
33
-
34
- this.options = opts;
35
- }
36
-
37
- /**
38
- * Check to see if tokens <= splat.length, assign { splat, meta } into the
39
- * `info` accordingly, and write to this instance.
40
- *
41
- * @param {Info} info Logform info message.
42
- * @param {String[]} tokens Set of string interpolation tokens.
43
- * @returns {Info} Modified info message
44
- * @private
45
- */
46
-
47
-
48
- _createClass(Splatter, [{
49
- key: '_splat',
50
- value: function _splat(info, tokens) {
51
- var msg = info.message;
52
- var splat = info[SPLAT] || info.splat || [];
53
- var percents = msg.match(escapedPercent);
54
- var escapes = percents && percents.length || 0;
55
-
56
- // The expected splat is the number of tokens minus the number of escapes
57
- // e.g.
58
- // - { expectedSplat: 3 } '%d %s %j'
59
- // - { expectedSplat: 5 } '[%s] %d%% %d%% %s %j'
60
- //
61
- // Any "meta" will be arugments in addition to the expected splat size
62
- // regardless of type. e.g.
63
- //
64
- // logger.log('info', '%d%% %s %j', 100, 'wow', { such: 'js' }, { thisIsMeta: true });
65
- // would result in splat of four (4), but only three (3) are expected. Therefore:
66
- //
67
- // extraSplat = 3 - 4 = -1
68
- // metas = [100, 'wow', { such: 'js' }, { thisIsMeta: true }].splice(-1, -1 * -1);
69
- // splat = [100, 'wow', { such: 'js' }]
70
- var expectedSplat = tokens.length - escapes;
71
- var extraSplat = expectedSplat - splat.length;
72
- var metas = extraSplat < 0 ? splat.splice(extraSplat, -1 * extraSplat) : [];
73
-
74
- // Now that { splat } has been separated from any potential { meta }. we
75
- // can assign this to the `info` object and write it to our format stream.
76
- if (metas.length === 1) {
77
- info.meta = metas[0];
78
- } else if (metas.length) {
79
- info.meta = metas;
80
- }
81
-
82
- info.message = util.format.apply(util, [msg].concat(_toConsumableArray(splat)));
83
- return info;
84
- }
85
-
86
- /**
87
- * Transforms the `info` message by using `util.format` to complete
88
- * any `info.message` provided it has string interpolation tokens.
89
- * If no tokens exist then `info` is immutable.
90
- *
91
- * @param {Info} info Logform info message.
92
- * @param {Object} opts Options for this instance.
93
- * @returns {Info} Modified info message
94
- */
95
-
96
- }, {
97
- key: 'transform',
98
- value: function transform(info) {
99
- var msg = info.message;
100
- var splat = info[SPLAT] || info.splat;
101
-
102
- // No need to process anything if splat is undefined
103
- if (!splat || !splat.length) {
104
- return info;
105
- }
106
-
107
- // Extract tokens, if none available default to empty array to
108
- // ensure consistancy in expected results
109
- var tokens = msg && msg.match && msg.match(formatRegExp);
110
-
111
- // This condition will take care of inputs with info[SPLAT]
112
- // but no tokens present
113
- if (!tokens && (splat || splat.length)) {
114
- var metas = splat.length > 1 ? splat.splice(0) : splat;
115
-
116
- // Now that { splat } has been separated from any potential { meta }. we
117
- // can assign this to the `info` object and write it to our format stream.
118
- if (metas.length === 1) {
119
- info.meta = metas[0];
120
- } else if (metas.length) {
121
- info.meta = metas;
122
- }
123
- return info;
124
- }
125
-
126
- if (tokens) {
127
- return this._splat(info, tokens);
128
- }
129
-
130
- return info;
131
- }
132
- }]);
133
-
134
- return Splatter;
135
- }();
136
-
137
- /*
138
- * function splat (info)
139
- * Returns a new instance of the splat format TransformStream
140
- * which performs string interpolation from `info` objects. This was
141
- * previously exposed implicitly in `winston < 3.0.0`.
142
- */
143
-
144
-
145
- module.exports = function (opts) {
146
- return new Splatter(opts);
147
- };
@@ -1,28 +0,0 @@
1
- 'use strict';
2
-
3
- var fecha = require('fecha');
4
- var 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(function (info, opts) {
15
- if (opts.format) {
16
- info.timestamp = typeof opts.format === 'function' ? opts.format() : fecha.format(new Date(), opts.format);
17
- }
18
-
19
- if (!info.timestamp) {
20
- info.timestamp = new Date().toISOString();
21
- }
22
-
23
- if (opts.alias) {
24
- info[opts.alias] = info.timestamp;
25
- }
26
-
27
- return info;
28
- });
@@ -1,31 +0,0 @@
1
- 'use strict';
2
-
3
- var colors = require('colors/safe');
4
- var format = require('./format');
5
-
6
- var _require = require('triple-beam'),
7
- MESSAGE = _require.MESSAGE;
8
-
9
- /*
10
- * function uncolorize (info)
11
- * Returns a new instance of the uncolorize Format that strips colors
12
- * from `info` objects. This was previously exposed as { stripColors: true }
13
- * to transports in `winston < 3.0.0`.
14
- */
15
-
16
-
17
- module.exports = format(function (info, opts) {
18
- if (opts.level !== false) {
19
- info.level = colors.strip(info.level);
20
- }
21
-
22
- if (opts.message !== false) {
23
- info.message = colors.strip(info.message);
24
- }
25
-
26
- if (opts.raw !== false && info[MESSAGE]) {
27
- info[MESSAGE] = colors.strip(info[MESSAGE]);
28
- }
29
-
30
- return info;
31
- });
@@ -1,14 +0,0 @@
1
- const { format } = require('../');
2
- const { combine, timestamp, label } = format;
3
-
4
- const labelTimestamp = combine(
5
- label({ label: 'right meow!' }),
6
- timestamp()
7
- );
8
-
9
- const info = labelTimestamp.transform({
10
- level: 'info',
11
- message: 'What time is the testing at?'
12
- });
13
-
14
- console.dir(info);
@@ -1,30 +0,0 @@
1
- /* eslint no-unused-vars: 0 */
2
-
3
- const { format } = require('../');
4
- const { combine, timestamp, label } = format;
5
-
6
- const ignorePrivate = format((info, opts) => {
7
- if (info.private) { return false; }
8
- return info;
9
- })();
10
-
11
- console.dir(ignorePrivate.transform({
12
- level: 'error',
13
- message: 'Public error to share'
14
- }));
15
-
16
- console.dir(ignorePrivate.transform({
17
- level: 'error',
18
- private: true,
19
- message: 'This is super secret - hide it.'
20
- }));
21
-
22
- const willNeverThrow = format.combine(
23
- format(info => { return false; })(), // Ignores everything
24
- format(info => { throw new Error('Never reached'); })()
25
- );
26
-
27
- console.dir(willNeverThrow.transform({
28
- level: 'info',
29
- message: 'wow such testing'
30
- }));
@@ -1,6 +0,0 @@
1
- /* eslint no-unused-vars: 0 */
2
- const { format } = require('../');
3
-
4
- const invalid = format(function invalid(just, too, many, args) {
5
- return just;
6
- });
@@ -1,78 +0,0 @@
1
- const { format } = require('../');
2
- const { combine, json, metadata, timestamp } = format;
3
-
4
- // Default Functionality (no options passed)
5
- const defaultFormatter = combine(
6
- timestamp(),
7
- metadata(),
8
- json()
9
- );
10
-
11
- const defaultMessage = defaultFormatter.transform({
12
- level: 'info',
13
- message: 'This should be a message.',
14
- application: 'Microsoft Office',
15
- store: 'Big Box Store',
16
- purchaseAmount: '9.99'
17
- });
18
-
19
- console.dir(defaultMessage);
20
-
21
-
22
- // Fill all keys into metadata except those provided
23
- const formattedLogger = combine(
24
- timestamp(),
25
- metadata({ fillExcept: ['message', 'level', 'timestamp'] }),
26
- json()
27
- );
28
-
29
- const fillExceptMessage = formattedLogger.transform({
30
- level: 'info',
31
- message: 'This should have attached metadata',
32
- category: 'movies',
33
- subCategory: 'action'
34
- });
35
-
36
- console.dir(fillExceptMessage);
37
-
38
-
39
- // Fill only the keys provided into the object, and also give it a different key
40
- const customMetadataLogger = combine(
41
- timestamp(),
42
- metadata({ fillWith: ['publisher', 'author', 'book'], key: 'bookInfo' }),
43
- json()
44
- );
45
-
46
- const fillWithMessage = customMetadataLogger.transform({
47
- level: 'debug',
48
- message: 'This message should be outside of the bookInfo object',
49
- publisher: 'Lorem Press',
50
- author: 'Albert Einstein',
51
- book: '4D Chess for Dummies',
52
- label: 'myCustomLabel'
53
- });
54
-
55
- console.dir(fillWithMessage);
56
-
57
- // Demonstrates Metadata 'chaining' to combine multiple datapoints.
58
- const chainedMetadata = combine(
59
- timestamp(),
60
- metadata({ fillWith: ['publisher', 'author', 'book'], key: 'bookInfo' }),
61
- metadata({ fillWith: ['purchasePrice', 'purchaseDate', 'transactionId'], key: 'transactionInfo' }),
62
- metadata({ fillExcept: ['level', 'message', 'label', 'timestamp'] }),
63
- json()
64
- );
65
-
66
- const chainedMessage = chainedMetadata.transform({
67
- level: 'debug',
68
- message: 'This message should be outside of the bookInfo object',
69
- publisher: 'Lorem Press',
70
- author: 'Albert Einstein',
71
- book: '4D Chess for Dummies',
72
- label: 'myCustomLabel',
73
- purchasePrice: '9.99',
74
- purchaseDate: '2.10.2018',
75
- transactionId: '123ABC'
76
- });
77
-
78
- console.dir(chainedMessage);
@@ -1,39 +0,0 @@
1
- const { format } = require('../');
2
- const { combine, padLevels, simple } = format;
3
-
4
- const { MESSAGE } = require('triple-beam');
5
-
6
- const paddedFormat = combine(
7
- padLevels({
8
- // Uncomment for a custom filler for the padding, defaults to ' '.
9
- // filler: 'foo',
10
- // Levels has to be defined, same as `winston.createLoggers({ levels })`.
11
- levels: {
12
- error: 0,
13
- warn: 1,
14
- info: 2,
15
- http: 3,
16
- verbose: 4,
17
- debug: 5,
18
- silly: 6
19
- }
20
- }),
21
- simple()
22
- );
23
-
24
- const info = paddedFormat.transform({
25
- level: 'info',
26
- message: 'This is an info level message.'
27
- });
28
- const error = paddedFormat.transform({
29
- level: 'error',
30
- message: 'This is an error level message.'
31
- });
32
- const verbose = paddedFormat.transform({
33
- level: 'verbose',
34
- message: 'This is a verbose level message.'
35
- });
36
-
37
- console.dir(info[MESSAGE]);
38
- console.dir(error[MESSAGE]);
39
- console.dir(verbose[MESSAGE]);
@@ -1,25 +0,0 @@
1
- const { format } = require('../');
2
-
3
- const volume = format((info, opts) => {
4
- if (opts.yell) {
5
- info.message = info.message.toUpperCase();
6
- } else if (opts.whisper) {
7
- info.message = info.message.toLowerCase();
8
- }
9
-
10
- return info;
11
- });
12
-
13
- // `volume` is now a function that returns instances of the format.
14
- const scream = volume({ yell: true });
15
- console.dir(scream.transform({
16
- level: 'info',
17
- message: `sorry for making you YELL in your head!`
18
- }, scream.options));
19
-
20
- // `volume` can be used multiple times to create different formats.
21
- const whisper = volume({ whisper: true });
22
- console.dir(whisper.transform({
23
- level: 'info',
24
- message: `WHY ARE THEY MAKING US YELL SO MUCH!`
25
- }, whisper.options));
@@ -1,52 +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
- class InvalidFormatError extends Error {
8
- constructor(formatFn) {
9
- super(`Format functions must be synchronous taking a two arguments: (info, opts)
10
- Found: ${formatFn.toString().split('\n')[0]}\n`);
11
-
12
- Error.captureStackTrace(this, InvalidFormatError);
13
- }
14
- }
15
-
16
- /*
17
- * function format (formatFn)
18
- * Returns a create function for the `formatFn`.
19
- */
20
- module.exports = formatFn => {
21
- if (formatFn.length > 2) {
22
- throw new InvalidFormatError(formatFn);
23
- }
24
-
25
- /*
26
- * function Format (options)
27
- * Base prototype which calls a `_format`
28
- * function and pushes the result.
29
- */
30
- function Format(options = {}) {
31
- this.options = options;
32
- }
33
-
34
- Format.prototype.transform = formatFn;
35
-
36
- //
37
- // Create a function which returns new instances of
38
- // FormatWrap for simple syntax like:
39
- //
40
- // require('winston').formats.json();
41
- //
42
- function createFormatWrap(opts) {
43
- return new Format(opts);
44
- }
45
-
46
- //
47
- // Expose the FormatWrap through the create function
48
- // for testability.
49
- //
50
- createFormatWrap.Format = Format;
51
- return createFormatWrap;
52
- };