@contrast/agent 4.32.11 → 4.32.13

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 (223) hide show
  1. package/lib/core/config/util.js +2 -1
  2. package/node_modules/file-stream-rotator/FileStreamRotator.js +200 -41
  3. package/node_modules/file-stream-rotator/LICENSE.txt +17 -0
  4. package/node_modules/file-stream-rotator/README.md +16 -1
  5. package/node_modules/file-stream-rotator/package.json +5 -5
  6. package/node_modules/file-stream-rotator/tests/every-minute-test.js +32 -15
  7. package/node_modules/file-stream-rotator/tests/every-second-test.js +16 -7
  8. package/node_modules/file-stream-rotator/tests/large-test.js +33 -0
  9. package/node_modules/file-stream-rotator/tests/rotate-on-size-without-date.js +103 -0
  10. package/node_modules/object-hash/dist/object_hash.js +1 -2
  11. package/node_modules/object-hash/index.js +33 -21
  12. package/node_modules/object-hash/package.json +20 -18
  13. package/node_modules/object-hash/readme.markdown +20 -5
  14. package/node_modules/winston-daily-rotate-file/README.md +81 -12
  15. package/node_modules/winston-daily-rotate-file/daily-rotate-file.js +69 -30
  16. package/node_modules/winston-daily-rotate-file/index.d.ts +119 -72
  17. package/node_modules/winston-daily-rotate-file/package.json +20 -19
  18. package/node_modules/winston-transport/.eslintrc +1 -1
  19. package/node_modules/winston-transport/.nyc_output/c3d7ddb9-cc26-466b-a4f6-993ad69e86f6.json +1 -0
  20. package/node_modules/winston-transport/.nyc_output/processinfo/c3d7ddb9-cc26-466b-a4f6-993ad69e86f6.json +1 -0
  21. package/node_modules/winston-transport/.nyc_output/processinfo/index.json +1 -1
  22. package/node_modules/winston-transport/CHANGELOG.md +11 -0
  23. package/node_modules/winston-transport/dist/index.js +2 -2
  24. package/node_modules/winston-transport/index.d.ts +2 -0
  25. package/node_modules/winston-transport/index.js +2 -2
  26. package/node_modules/winston-transport/node_modules/readable-stream/README.md +106 -0
  27. package/node_modules/winston-transport/node_modules/readable-stream/errors-browser.js +127 -0
  28. package/node_modules/winston-transport/node_modules/readable-stream/errors.js +116 -0
  29. package/node_modules/winston-transport/node_modules/readable-stream/experimentalWarning.js +17 -0
  30. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_duplex.js +41 -46
  31. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_passthrough.js +1 -11
  32. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_readable.js +271 -263
  33. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_transform.js +18 -42
  34. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_writable.js +101 -147
  35. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/async_iterator.js +180 -0
  36. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/buffer_list.js +183 -0
  37. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/destroy.js +96 -0
  38. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +86 -0
  39. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/from-browser.js +3 -0
  40. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/from.js +52 -0
  41. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/pipeline.js +86 -0
  42. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/state.js +22 -0
  43. package/node_modules/winston-transport/node_modules/readable-stream/package.json +72 -0
  44. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/readable-browser.js +2 -0
  45. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/readable.js +5 -8
  46. package/node_modules/winston-transport/package.json +16 -14
  47. package/package.json +7 -7
  48. package/node_modules/colors/LICENSE +0 -25
  49. package/node_modules/colors/README.md +0 -221
  50. package/node_modules/colors/examples/normal-usage.js +0 -82
  51. package/node_modules/colors/examples/safe-string.js +0 -79
  52. package/node_modules/colors/index.d.ts +0 -136
  53. package/node_modules/colors/lib/colors.js +0 -211
  54. package/node_modules/colors/lib/custom/trap.js +0 -46
  55. package/node_modules/colors/lib/custom/zalgo.js +0 -110
  56. package/node_modules/colors/lib/extendStringPrototype.js +0 -110
  57. package/node_modules/colors/lib/index.js +0 -13
  58. package/node_modules/colors/lib/maps/america.js +0 -10
  59. package/node_modules/colors/lib/maps/rainbow.js +0 -12
  60. package/node_modules/colors/lib/maps/random.js +0 -11
  61. package/node_modules/colors/lib/maps/zebra.js +0 -5
  62. package/node_modules/colors/lib/styles.js +0 -95
  63. package/node_modules/colors/lib/system/has-flag.js +0 -35
  64. package/node_modules/colors/lib/system/supports-colors.js +0 -151
  65. package/node_modules/colors/package.json +0 -49
  66. package/node_modules/colors/safe.d.ts +0 -48
  67. package/node_modules/colors/safe.js +0 -10
  68. package/node_modules/colors/themes/generic-logging.js +0 -12
  69. package/node_modules/core-util-is/LICENSE +0 -19
  70. package/node_modules/core-util-is/README.md +0 -3
  71. package/node_modules/core-util-is/float.patch +0 -604
  72. package/node_modules/core-util-is/lib/util.js +0 -107
  73. package/node_modules/core-util-is/package.json +0 -36
  74. package/node_modules/core-util-is/test.js +0 -68
  75. package/node_modules/cycle/README.md +0 -49
  76. package/node_modules/cycle/cycle.js +0 -170
  77. package/node_modules/cycle/package.json +0 -16
  78. package/node_modules/fast-safe-stringify/.travis.yml +0 -8
  79. package/node_modules/fast-safe-stringify/CHANGELOG.md +0 -17
  80. package/node_modules/fast-safe-stringify/LICENSE +0 -23
  81. package/node_modules/fast-safe-stringify/benchmark.js +0 -137
  82. package/node_modules/fast-safe-stringify/index.d.ts +0 -8
  83. package/node_modules/fast-safe-stringify/index.js +0 -161
  84. package/node_modules/fast-safe-stringify/package.json +0 -50
  85. package/node_modules/fast-safe-stringify/readme.md +0 -154
  86. package/node_modules/fast-safe-stringify/test-stable.js +0 -311
  87. package/node_modules/fast-safe-stringify/test.js +0 -304
  88. package/node_modules/isarray/.npmignore +0 -1
  89. package/node_modules/isarray/.travis.yml +0 -4
  90. package/node_modules/isarray/Makefile +0 -6
  91. package/node_modules/isarray/README.md +0 -60
  92. package/node_modules/isarray/component.json +0 -19
  93. package/node_modules/isarray/index.js +0 -5
  94. package/node_modules/isarray/package.json +0 -49
  95. package/node_modules/isarray/test.js +0 -20
  96. package/node_modules/object-hash/.jshintrc +0 -19
  97. package/node_modules/object-hash/.travis.yml +0 -35
  98. package/node_modules/object-hash/bower.json +0 -15
  99. package/node_modules/object-hash/dist/object_hash.js.map +0 -1
  100. package/node_modules/object-hash/dist/object_hash_test.js +0 -4737
  101. package/node_modules/object-hash/gulpfile.js +0 -97
  102. package/node_modules/object-hash/karma.conf.js +0 -69
  103. package/node_modules/object-hash/test/blob.js +0 -41
  104. package/node_modules/object-hash/test/index.js +0 -290
  105. package/node_modules/object-hash/test/object-classes.js +0 -106
  106. package/node_modules/object-hash/test/old-crypto.js +0 -60
  107. package/node_modules/object-hash/test/replacer.js +0 -36
  108. package/node_modules/object-hash/test/types.js +0 -174
  109. package/node_modules/object-hash/test/writeToStream.js +0 -27
  110. package/node_modules/process-nextick-args/index.js +0 -45
  111. package/node_modules/process-nextick-args/license.md +0 -19
  112. package/node_modules/process-nextick-args/package.json +0 -29
  113. package/node_modules/process-nextick-args/readme.md +0 -18
  114. package/node_modules/readable-stream/.travis.yml +0 -34
  115. package/node_modules/readable-stream/README.md +0 -58
  116. package/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +0 -60
  117. package/node_modules/readable-stream/duplex-browser.js +0 -1
  118. package/node_modules/readable-stream/duplex.js +0 -1
  119. package/node_modules/readable-stream/lib/internal/streams/BufferList.js +0 -79
  120. package/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -74
  121. package/node_modules/readable-stream/package.json +0 -56
  122. package/node_modules/readable-stream/passthrough.js +0 -1
  123. package/node_modules/readable-stream/transform.js +0 -1
  124. package/node_modules/readable-stream/writable-browser.js +0 -1
  125. package/node_modules/readable-stream/writable.js +0 -8
  126. package/node_modules/winston-compat/.gitattributes +0 -1
  127. package/node_modules/winston-compat/.node-version +0 -1
  128. package/node_modules/winston-compat/CHANGELOG.md +0 -17
  129. package/node_modules/winston-compat/LICENSE +0 -22
  130. package/node_modules/winston-compat/README.md +0 -2
  131. package/node_modules/winston-compat/index.js +0 -295
  132. package/node_modules/winston-compat/lib/transport.js +0 -135
  133. package/node_modules/winston-compat/node_modules/fecha/CHANGELOG.md +0 -11
  134. package/node_modules/winston-compat/node_modules/fecha/LICENSE +0 -22
  135. package/node_modules/winston-compat/node_modules/fecha/README.md +0 -259
  136. package/node_modules/winston-compat/node_modules/fecha/fecha.d.ts +0 -47
  137. package/node_modules/winston-compat/node_modules/fecha/fecha.js +0 -334
  138. package/node_modules/winston-compat/node_modules/fecha/fecha.min.js +0 -1
  139. package/node_modules/winston-compat/node_modules/fecha/package.json +0 -44
  140. package/node_modules/winston-compat/node_modules/logform/.babelrc +0 -3
  141. package/node_modules/winston-compat/node_modules/logform/.eslintrc +0 -7
  142. package/node_modules/winston-compat/node_modules/logform/.gitattributes +0 -1
  143. package/node_modules/winston-compat/node_modules/logform/.travis.yml +0 -17
  144. package/node_modules/winston-compat/node_modules/logform/CHANGELOG.md +0 -103
  145. package/node_modules/winston-compat/node_modules/logform/LICENSE +0 -21
  146. package/node_modules/winston-compat/node_modules/logform/README.md +0 -170
  147. package/node_modules/winston-compat/node_modules/logform/align.js +0 -14
  148. package/node_modules/winston-compat/node_modules/logform/browser.js +0 -36
  149. package/node_modules/winston-compat/node_modules/logform/cli.js +0 -52
  150. package/node_modules/winston-compat/node_modules/logform/colorize.js +0 -118
  151. package/node_modules/winston-compat/node_modules/logform/combine.js +0 -66
  152. package/node_modules/winston-compat/node_modules/logform/dist/align.js +0 -14
  153. package/node_modules/winston-compat/node_modules/logform/dist/browser.js +0 -37
  154. package/node_modules/winston-compat/node_modules/logform/dist/cli.js +0 -75
  155. package/node_modules/winston-compat/node_modules/logform/dist/colorize.js +0 -147
  156. package/node_modules/winston-compat/node_modules/logform/dist/combine.js +0 -66
  157. package/node_modules/winston-compat/node_modules/logform/dist/format.js +0 -69
  158. package/node_modules/winston-compat/node_modules/logform/dist/index.js +0 -54
  159. package/node_modules/winston-compat/node_modules/logform/dist/json.js +0 -27
  160. package/node_modules/winston-compat/node_modules/logform/dist/label.js +0 -19
  161. package/node_modules/winston-compat/node_modules/logform/dist/levels.js +0 -15
  162. package/node_modules/winston-compat/node_modules/logform/dist/logstash.js +0 -32
  163. package/node_modules/winston-compat/node_modules/logform/dist/metadata.js +0 -63
  164. package/node_modules/winston-compat/node_modules/logform/dist/ms.js +0 -18
  165. package/node_modules/winston-compat/node_modules/logform/dist/pad-levels.js +0 -118
  166. package/node_modules/winston-compat/node_modules/logform/dist/pretty-print.js +0 -20
  167. package/node_modules/winston-compat/node_modules/logform/dist/printf.js +0 -40
  168. package/node_modules/winston-compat/node_modules/logform/dist/simple.js +0 -36
  169. package/node_modules/winston-compat/node_modules/logform/dist/splat.js +0 -147
  170. package/node_modules/winston-compat/node_modules/logform/dist/timestamp.js +0 -28
  171. package/node_modules/winston-compat/node_modules/logform/dist/uncolorize.js +0 -31
  172. package/node_modules/winston-compat/node_modules/logform/examples/combine.js +0 -14
  173. package/node_modules/winston-compat/node_modules/logform/examples/filter.js +0 -30
  174. package/node_modules/winston-compat/node_modules/logform/examples/invalid.js +0 -6
  175. package/node_modules/winston-compat/node_modules/logform/examples/metadata.js +0 -78
  176. package/node_modules/winston-compat/node_modules/logform/examples/padLevels.js +0 -39
  177. package/node_modules/winston-compat/node_modules/logform/examples/volume.js +0 -25
  178. package/node_modules/winston-compat/node_modules/logform/format.js +0 -52
  179. package/node_modules/winston-compat/node_modules/logform/index.d.ts +0 -53
  180. package/node_modules/winston-compat/node_modules/logform/index.js +0 -52
  181. package/node_modules/winston-compat/node_modules/logform/json.js +0 -26
  182. package/node_modules/winston-compat/node_modules/logform/label.js +0 -19
  183. package/node_modules/winston-compat/node_modules/logform/levels.js +0 -12
  184. package/node_modules/winston-compat/node_modules/logform/logstash.js +0 -29
  185. package/node_modules/winston-compat/node_modules/logform/metadata.js +0 -61
  186. package/node_modules/winston-compat/node_modules/logform/ms.js +0 -18
  187. package/node_modules/winston-compat/node_modules/logform/package.json +0 -51
  188. package/node_modules/winston-compat/node_modules/logform/pad-levels.js +0 -83
  189. package/node_modules/winston-compat/node_modules/logform/pretty-print.js +0 -16
  190. package/node_modules/winston-compat/node_modules/logform/printf.js +0 -26
  191. package/node_modules/winston-compat/node_modules/logform/simple.js +0 -33
  192. package/node_modules/winston-compat/node_modules/logform/splat.js +0 -125
  193. package/node_modules/winston-compat/node_modules/logform/timestamp.js +0 -30
  194. package/node_modules/winston-compat/node_modules/logform/tsconfig.json +0 -22
  195. package/node_modules/winston-compat/node_modules/logform/uncolorize.js +0 -27
  196. package/node_modules/winston-compat/package.json +0 -46
  197. package/node_modules/winston-compat/test/clone.test.js +0 -25
  198. package/node_modules/winston-compat/test/helpers.js +0 -256
  199. package/node_modules/winston-compat/test/timestamp.test.js +0 -14
  200. package/node_modules/winston-compat/test/transports/transport.js +0 -205
  201. package/node_modules/winston-compat/test/winston-compat.test.js +0 -18
  202. package/node_modules/winston-daily-rotate-file/.eslintrc.js +0 -11
  203. package/node_modules/winston-daily-rotate-file/.node-version +0 -1
  204. package/node_modules/winston-daily-rotate-file/.travis.yml +0 -15
  205. package/node_modules/winston-daily-rotate-file/node_modules/semver/CHANGELOG.md +0 -70
  206. package/node_modules/winston-daily-rotate-file/node_modules/semver/LICENSE +0 -15
  207. package/node_modules/winston-daily-rotate-file/node_modules/semver/README.md +0 -443
  208. package/node_modules/winston-daily-rotate-file/node_modules/semver/bin/semver.js +0 -174
  209. package/node_modules/winston-daily-rotate-file/node_modules/semver/package.json +0 -32
  210. package/node_modules/winston-daily-rotate-file/node_modules/semver/range.bnf +0 -16
  211. package/node_modules/winston-daily-rotate-file/node_modules/semver/semver.js +0 -1596
  212. package/node_modules/winston-daily-rotate-file/test/memory-stream.js +0 -38
  213. package/node_modules/winston-daily-rotate-file/test/random-string.js +0 -31
  214. package/node_modules/winston-daily-rotate-file/test/transport-tests.js +0 -250
  215. package/node_modules/winston-transport/.nyc_output/1c69f3e4-4c25-457d-9df5-dfa761729528.json +0 -1
  216. package/node_modules/winston-transport/.nyc_output/processinfo/1c69f3e4-4c25-457d-9df5-dfa761729528.json +0 -1
  217. package/node_modules/winston-transport/.travis.yml +0 -17
  218. package/node_modules/winston-transport/tsconfig.json +0 -22
  219. /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/CONTRIBUTING.md +0 -0
  220. /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/GOVERNANCE.md +0 -0
  221. /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/LICENSE +0 -0
  222. /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/internal/streams/stream-browser.js +0 -0
  223. /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/internal/streams/stream.js +0 -0
@@ -1,7 +0,0 @@
1
- {
2
- "extends": "populist",
3
- "rules": {
4
- "no-undefined": 0,
5
- "strict": 0
6
- }
7
- }
@@ -1 +0,0 @@
1
- package-lock.json binary
@@ -1,17 +0,0 @@
1
- sudo: false
2
- language: node_js
3
- node_js:
4
- - "6"
5
- - "8"
6
- - "10"
7
-
8
- before_install:
9
- - travis_retry npm install
10
-
11
- script:
12
- - npm test
13
-
14
- notifications:
15
- email:
16
- - travis@nodejitsu.com
17
- irc: "irc.freenode.org#nodejitsu"
@@ -1,103 +0,0 @@
1
- # CHANGELOG
2
-
3
- ### 1.10.0
4
- **2018/09/17**
5
-
6
- - [#52] Add types field in package.json.
7
- - [#46], [#49] Changes for splat when there are no tokens present and no splat present.
8
- - [#47], [#53] Expose transpiled code for Browser-only scenarios.
9
-
10
- ### 1.9.1
11
- **2018/06/26**
12
-
13
- - [#39] Don't break when there are % placeholders but no values.
14
- - [#42] Only set `meta` when non-zero additional `SPLAT` arguments are
15
- provided. (Fixes [winstonjs/winston#1358]).
16
-
17
- ### 1.9.0
18
- **2018/06/12**
19
-
20
- - [#38] Migrate functionality from winston Logger to splat format.
21
- - [#37] Match expectations from `winston@2.x` for padLevels. Create a correct `Cli` format with initial state. (Fixes [#36]).
22
-
23
- ### 1.8.0
24
- **2018/06/11**
25
-
26
- - [#35] Use `fast-safe-stringify` for perf and to support circular refs.
27
- - [#34] Colorize level symbol.
28
-
29
- ### 1.7.0
30
- **2018/05/24**
31
-
32
- - [#28] Use more es6-features across the board.
33
- - [#30] Fix combine return value.
34
- - [#29] Add metadata function to format namespace.
35
-
36
- ### 1.6.0
37
- **2018/04/25**
38
-
39
- - [#25] Implement padLevels format.
40
- - [#26] Update `dependencies` and add `node@10` to the travis build of the project.
41
- - [#27] Refactor logform to use triple-beam.
42
-
43
- ### 1.5.0
44
- **2018/04/22**
45
-
46
- - [#23], (@ChrisAlderson) Add ms format to support '+N ms' format. Fixes #20.
47
- - [#24], (@aneilbaboo) Fix `webpack` warnings.
48
- - Add `.travis.yml`.
49
-
50
- ### 1.4.2
51
- **2018/04/19**
52
-
53
- - [#22], (@Jasu) Fix compilation on Babel 6.
54
-
55
- ### 1.4.1
56
- **2018/04/06**
57
-
58
- - [#21], (@dabh) Add tsconfig.json. Fixes #19.
59
-
60
- ### 1.4.0
61
- **2018/03/23**
62
-
63
- - [#14] @iamkirkbater Added Initial Metadata Support.
64
- - Correct JSDoc for printf.js. Fixes #10.
65
-
66
- ### 1.3.0
67
- **2018/03/16**
68
-
69
- - [#18] Expose browser.js for rollup and the like. Fixes [#5].
70
- - [#13] @dabh Use new version of colors.
71
- - [#15] @dabh Add Typescript typings (ported from DefinitelyTyped).
72
- - [#17], [#16] Fix error messages other typos.
73
-
74
- ### 1.2.2
75
- **2017/12/05**
76
-
77
- - [#4], [#11] Fix timestamp and replace `date-fns` with `fecha` (with test cases) [`@ChrisAlderson`].
78
-
79
- ### 1.2.1
80
- **2017/10/01**
81
-
82
- - [#3] Strip `info.splat` in `format.simple` to avoid double inclusion.
83
-
84
- ### 1.2.0
85
- **2017/09/30**
86
-
87
- - Transition from `info.raw` to `info[Symbol.for('message')]`.
88
- - Finish `README.md` except for full list of all built-in formats.
89
- - 100% coverage for everything except for `{ align, cli, padLevels }`.
90
-
91
- ### 1.1.0
92
- **2017/09/29**
93
-
94
- - [#2] Add baseline expected formats that were previously exposed as options to `common.log` in `winston@2.x` and below.
95
- - [#2] Introduce `format.combine` to remove inconsistency in behavior between `format(fn0)` and `format(fn0, ...moreFns)`.
96
- - [#2] `README.md` now covers all of the basics for `logform`.
97
-
98
- ### 1.0.0
99
- **2017/09/26**
100
-
101
- - Initial release.
102
-
103
- [winstonjs/winston#1358]: https://github.com/winstonjs/winston/issues/1358
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2017 Charlie Robbins & the Contributors.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,170 +0,0 @@
1
- # logform
2
-
3
- An mutable object-based log format designed for chaining & objectMode streams.
4
-
5
- ``` js
6
- const { format } = require('logform');
7
-
8
- const alignedWithColorsAndTime = format.combine(
9
- format.colorize(),
10
- format.timestamp(),
11
- format.align(),
12
- format.printf(info => `${info.timestamp} ${info.level}: ${info.message}`)
13
- );
14
- ```
15
-
16
- - [`info` Objects](#info-objects)
17
- - [Understanding formats](#understanding-formats)
18
- - [Combining formats](#combining-formats)
19
- - [Filtering `info` objects](#filtering-info-objects)
20
-
21
- ## `info` Objects
22
-
23
- The `info` parameter provided to a given format represents a single log message. The object itself is mutable. Every `info` must have at least the `level` and `message` properties:
24
-
25
- ``` js
26
- {
27
- level: 'info', // Level of the logging message
28
- message: 'Hey! Log something?' // Descriptive message being logged.
29
- }
30
- ```
31
-
32
- `logform` itself exposes several additional properties:
33
-
34
- - `splat`: string interpolation splat for `%d %s`-style messages.
35
- - `timestamp`: timestamp the message was received.
36
- - `label`: custom label associated with each message.
37
-
38
- As a consumer you may add whatever properties you wish – _internal state is maintained by `Symbol` properties:_
39
-
40
- - `Symbol.for('level')` _**(READ-ONLY)**:_ equal to `level` property. Is treated as immutable by all code.
41
- - `Symbol.for('message'):` complete string message set by "finalizing formats": `json`, `logstash`, `printf`, `prettyPrint`, and `simple`.
42
-
43
- ## Understanding formats
44
-
45
- Formats are prototypal objects (i.e. class instances) that define a single method: `transform(info, opts)` and return the mutated `info`
46
-
47
- - `info`: an object representing the log message.
48
- - `opts`: setting specific to the current instance of the format.
49
-
50
- They are expected to return one of two things:
51
-
52
- - **An `info` Object** representing the modified `info` argument. Object references need not be preserved if immutability is preferred. All current built-in formats consider `info` mutable, but [immutablejs] is being considered for future releases.
53
- - **A falsey value** indicating that the `info` argument should be ignored by the caller. (See: [Filtering `info` Objects](#filtering-info-objects)) below.
54
-
55
- `logform.format` is designed to be as simple as possible. To define a new format simple pass it a `transform(info, opts)` function to get a new `Format`.
56
-
57
- The named `Format` returned can be used to create as many copies of the given `Format` as desired:
58
-
59
- ``` js
60
- const { format } = require('logform');
61
-
62
- const volume = format((info, opts) => {
63
- if (opts.yell) {
64
- info.message = info.message.toUpperCase();
65
- } else if (opts.whisper) {
66
- info.message = info.message.toLowerCase();
67
- }
68
-
69
- return info;
70
- });
71
-
72
- // `volume` is now a function that returns instances of the format.
73
- const scream = volume({ yell: true });
74
- console.dir(scream.transform({
75
- level: 'info',
76
- message: `sorry for making you YELL in your head!`
77
- }, scream.options));
78
- // {
79
- // level: 'info'
80
- // message: 'SORRY FOR MAKING YOU YELL IN YOUR HEAD!'
81
- // }
82
-
83
- // `volume` can be used multiple times to create different formats.
84
- const whisper = volume({ whisper: true });
85
- console.dir(whisper.transform({
86
- level: 'info',
87
- message: `WHY ARE THEY MAKING US YELL SO MUCH!`
88
- }), whisper.options);
89
- // {
90
- // level: 'info'
91
- // message: 'why are they making us yell so much!'
92
- // }
93
- ```
94
-
95
- ### Combining formats
96
-
97
- Any number of formats may be combined into a single format using `format.combine`. Since `format.combine` takes no `opts`, as a convenience it returns pre-created instance of the combined format.
98
-
99
- ``` js
100
- const { format } = require('logform');
101
- const { combine, timestamp, label } = format;
102
-
103
- const labelTimestamp = combine(
104
- label({ label: 'right meow!' }),
105
- timestamp()
106
- );
107
-
108
- const info = labelTimestamp.transform({
109
- level: 'info',
110
- message: 'What time is the testing at?'
111
- });
112
-
113
- console.dir(info);
114
- // { level: 'info',
115
- // message: 'What time is the testing at?',
116
- // label: 'right meow!',
117
- // timestamp: '2017-09-30T03:57:26.875Z' }
118
- ```
119
-
120
- ### Filtering `info` Objects
121
-
122
- If you wish to filter out a given `info` Object completely then simply return a falsey value.
123
-
124
- ``` js
125
- const ignorePrivate = format((info, opts) => {
126
- if (info.private) { return false; }
127
- return info;
128
- });
129
-
130
- console.dir(ignorePrivate.transform({
131
- level: 'error',
132
- message: 'Public error to share'
133
- }));
134
- // { level: 'error', message: 'Public error to share' }
135
-
136
- console.dir(ignorePrivate.transform({
137
- level: 'error',
138
- private: true,
139
- message: 'This is super secret - hide it.'
140
- }));
141
- // false
142
- ```
143
-
144
- Use of `format.combine` will respect any falsey values return and stop evaluation of later formats in the series. For example:
145
-
146
- ``` js
147
- const { format } = require('logform');
148
- const { combine, timestamp, label } = format;
149
-
150
- const willNeverThrow = format.combine(
151
- format(info => { return false })(), // Ignores everything
152
- format(info => { throw new Error('Never reached') })()
153
- );
154
-
155
- console.dir(willNeverThrow.transform({
156
- level: 'info',
157
- message: 'wow such testing'
158
- }))
159
- ```
160
-
161
- ## Tests
162
-
163
- Tests are written with `mocha`, `assume`, and `nyc`. They can be run with `npm`:
164
-
165
- ```
166
- npm test
167
- ```
168
-
169
- ##### LICENSE: MIT
170
- ##### AUTHOR: [Charlie Robbins](https://github.com/indexzero)
@@ -1,14 +0,0 @@
1
- 'use strict';
2
-
3
- const format = require('./format');
4
-
5
- /*
6
- * function align (info)
7
- * Returns a new instance of the align Format which adds a `\t`
8
- * delimiter before the message to properly align it in the same place.
9
- * It was previously { align: true } in winston < 3.0.0
10
- */
11
- module.exports = format(info => {
12
- info.message = `\t${info.message}`;
13
- return info;
14
- });
@@ -1,36 +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
- // Setup all transports as eager-loaded exports
20
- // so that they are static for the bundlers.
21
- //
22
- Object.defineProperty(format, 'align', { value: require('./align') });
23
- Object.defineProperty(format, 'cli', { value: require('./cli') });
24
- Object.defineProperty(format, 'combine', { value: require('./combine') });
25
- Object.defineProperty(format, 'colorize', { value: require('./colorize') });
26
- Object.defineProperty(format, 'json', { value: require('./json') });
27
- Object.defineProperty(format, 'label', { value: require('./label') });
28
- Object.defineProperty(format, 'logstash', { value: require('./logstash') });
29
- Object.defineProperty(format, 'metadata', { value: require('./metadata') });
30
- Object.defineProperty(format, 'padLevels', { value: require('./pad-levels') });
31
- Object.defineProperty(format, 'prettyPrint', { value: require('./pretty-print') });
32
- Object.defineProperty(format, 'printf', { value: require('./printf') });
33
- Object.defineProperty(format, 'simple', { value: require('./simple') });
34
- Object.defineProperty(format, 'splat', { value: require('./splat') });
35
- Object.defineProperty(format, 'timestamp', { value: require('./timestamp') });
36
- Object.defineProperty(format, 'uncolorize', { value: require('./uncolorize') });
@@ -1,52 +0,0 @@
1
- 'use strict';
2
-
3
- const { Colorizer } = require('./colorize');
4
- const { Padder } = require('./pad-levels');
5
- const { configs, MESSAGE } = require('triple-beam');
6
-
7
-
8
- /**
9
- * Cli format class that handles initial state for a a separate
10
- * Colorizer and Padder instance.
11
- */
12
- class CliFormat {
13
- constructor(opts = {}) {
14
- if (!opts.levels) {
15
- opts.levels = configs.npm.levels;
16
- }
17
-
18
- this.colorizer = new Colorizer(opts);
19
- this.padder = new Padder(opts);
20
- this.options = opts;
21
- }
22
-
23
- /*
24
- * function transform (info, opts)
25
- * Attempts to both:
26
- * 1. Pad the { level }
27
- * 2. Colorize the { level, message }
28
- * of the given `logform` info object depending on the `opts`.
29
- */
30
- transform(info, opts) {
31
- this.colorizer.transform(
32
- this.padder.transform(info, opts),
33
- opts
34
- );
35
-
36
- info[MESSAGE] = `${info.level}:${info.message}`;
37
- return info;
38
- }
39
- }
40
-
41
- /*
42
- * function cli (opts)
43
- * Returns a new instance of the CLI format that turns a log
44
- * `info` object into the same format previously available
45
- * in `winston.cli()` in `winston < 3.0.0`.
46
- */
47
- module.exports = opts => new CliFormat(opts);
48
-
49
- //
50
- // Attach the CliFormat for registration purposes
51
- //
52
- module.exports.Format = CliFormat;
@@ -1,118 +0,0 @@
1
- 'use strict';
2
-
3
- const colors = require('colors/safe');
4
- const { LEVEL } = require('triple-beam');
5
-
6
- //
7
- // Fix colors not appearing in non-tty environments
8
- //
9
- colors.enabled = true;
10
-
11
- /**
12
- * @property {RegExp} hasSpace
13
- * Simple regex to check for presence of spaces.
14
- */
15
- const hasSpace = /\s+/;
16
-
17
- /*
18
- * Colorizer format. Wraps the `level` and/or `message` properties
19
- * of the `info` objects with ANSI color codes based on a few options.
20
- */
21
- class Colorizer {
22
- constructor(opts = {}) {
23
- if (opts.colors) {
24
- this.addColors(opts.colors);
25
- }
26
-
27
- this.options = opts;
28
- }
29
-
30
- /*
31
- * Adds the colors Object to the set of allColors
32
- * known by the Colorizer
33
- *
34
- * @param {Object} colors Set of color mappings to add.
35
- */
36
- static addColors(clrs) {
37
- const nextColors = Object.keys(clrs).reduce((acc, level) => {
38
- acc[level] = hasSpace.test(clrs[level])
39
- ? clrs[level].split(hasSpace)
40
- : clrs[level];
41
-
42
- return acc;
43
- }, {});
44
-
45
- Colorizer.allColors = Object.assign({}, Colorizer.allColors || {}, nextColors);
46
- return Colorizer.allColors;
47
- }
48
-
49
- /*
50
- * Adds the colors Object to the set of allColors
51
- * known by the Colorizer
52
- *
53
- * @param {Object} colors Set of color mappings to add.
54
- */
55
- addColors(clrs) {
56
- return Colorizer.addColors(clrs);
57
- }
58
-
59
- /*
60
- * function colorize (lookup, level, message)
61
- * Performs multi-step colorization using colors/safe
62
- */
63
- colorize(lookup, level, message) {
64
- if (typeof message === 'undefined') {
65
- message = level;
66
- }
67
-
68
- //
69
- // If the color for the level is just a string
70
- // then attempt to colorize the message with it.
71
- //
72
- if (!Array.isArray(Colorizer.allColors[lookup])) {
73
- return colors[Colorizer.allColors[lookup]](message);
74
- }
75
-
76
- //
77
- // If it is an Array then iterate over that Array, applying
78
- // the colors function for each item.
79
- //
80
- for (let i = 0, len = Colorizer.allColors[lookup].length; i < len; i++) {
81
- message = colors[Colorizer.allColors[lookup][i]](message);
82
- }
83
-
84
- return message;
85
- }
86
-
87
- /*
88
- * function transform (info, opts)
89
- * Attempts to colorize the { level, message } of the given
90
- * `logform` info object.
91
- */
92
- transform(info, opts) {
93
- if (opts.level || opts.all || !opts.message) {
94
- info.level = this.colorize(info[LEVEL], info.level);
95
- }
96
-
97
- if (opts.all || opts.message) {
98
- info.message = this.colorize(info[LEVEL], info.level, info.message);
99
- }
100
-
101
- return info;
102
- }
103
- }
104
-
105
- /*
106
- * function colorize (info)
107
- * Returns a new instance of the colorize Format that applies
108
- * level colors to `info` objects. This was previously exposed
109
- * as { colorize: true } to transports in `winston < 3.0.0`.
110
- */
111
- module.exports = opts => new Colorizer(opts);
112
-
113
- //
114
- // Attach the Colorizer for registration purposes
115
- //
116
- module.exports.Colorizer
117
- = module.exports.Format
118
- = Colorizer;
@@ -1,66 +0,0 @@
1
- 'use strict';
2
-
3
- const 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 info => {
18
- let obj = info;
19
- for (let 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([
38
- 'No transform function found on format. Did you create a format instance?',
39
- 'const myFormat = format(formatFn);',
40
- 'const instance = myFormat();'
41
- ].join('\n'));
42
- }
43
-
44
- return true;
45
- }
46
-
47
- /*
48
- * function combine (info)
49
- * Returns a new instance of the combine Format which combines the specified
50
- * formats into a new format. This is similar to a pipe-chain in transform streams.
51
- * We choose to combine the prototypes this way because there is no back pressure in
52
- * an in-memory transform chain.
53
- */
54
- module.exports = (...formats) => {
55
- const combinedFormat = format(cascade(formats));
56
- const 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,14 +0,0 @@
1
- 'use strict';
2
-
3
- var format = require('./format');
4
-
5
- /*
6
- * function align (info)
7
- * Returns a new instance of the align Format which adds a `\t`
8
- * delimiter before the message to properly align it in the same place.
9
- * It was previously { align: true } in winston < 3.0.0
10
- */
11
- module.exports = format(function (info) {
12
- info.message = '\t' + info.message;
13
- return info;
14
- });
@@ -1,37 +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
- // Setup all transports as eager-loaded exports
21
- // so that they are static for the bundlers.
22
- //
23
- Object.defineProperty(format, 'align', { value: require('./align') });
24
- Object.defineProperty(format, 'cli', { value: require('./cli') });
25
- Object.defineProperty(format, 'combine', { value: require('./combine') });
26
- Object.defineProperty(format, 'colorize', { value: require('./colorize') });
27
- Object.defineProperty(format, 'json', { value: require('./json') });
28
- Object.defineProperty(format, 'label', { value: require('./label') });
29
- Object.defineProperty(format, 'logstash', { value: require('./logstash') });
30
- Object.defineProperty(format, 'metadata', { value: require('./metadata') });
31
- Object.defineProperty(format, 'padLevels', { value: require('./pad-levels') });
32
- Object.defineProperty(format, 'prettyPrint', { value: require('./pretty-print') });
33
- Object.defineProperty(format, 'printf', { value: require('./printf') });
34
- Object.defineProperty(format, 'simple', { value: require('./simple') });
35
- Object.defineProperty(format, 'splat', { value: require('./splat') });
36
- Object.defineProperty(format, 'timestamp', { value: require('./timestamp') });
37
- Object.defineProperty(format, 'uncolorize', { value: require('./uncolorize') });