@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
@@ -155,8 +155,9 @@ function checkConfigPath() {
155
155
  os.platform() === 'win32'
156
156
  ? `${process.env['ProgramData']}\\contrast`
157
157
  : '/etc/contrast';
158
+ const configSubDir = `${configDir}${path.sep}node`;
158
159
 
159
- for (const dir of [process.cwd(), configDir]) {
160
+ for (const dir of [process.cwd(), configSubDir, configDir]) {
160
161
  const checkPath = path.resolve(dir, 'contrast_security.yaml');
161
162
  if (fs.existsSync(checkPath)) {
162
163
  return checkPath;
@@ -49,6 +49,19 @@ var EventEmitter = require('events');
49
49
  *
50
50
  * - `file_options` An object passed to the stream. This can be used to specify flags, encoding, and mode.
51
51
  * See https://nodejs.org/api/fs.html#fs_fs_createwritestream_path_options. Default `{ flags: 'a' }`.
52
+ *
53
+ * - `utc` Use UTC time for date in filename. Defaults to 'FALSE'
54
+ *
55
+ * - `extension` File extension to be appended to the filename. This is useful when using size restrictions as the rotation
56
+ * adds a count (1,2,3,4,...) at the end of the filename when the required size is met.
57
+ *
58
+ * - `watch_log` Watch the current file being written to and recreate it in case of accidental deletion. Defaults to 'FALSE'
59
+ *
60
+ * - `create_symlink` Create a tailable symlink to the current active log file. Defaults to 'FALSE'
61
+ *
62
+ * - `symlink_name` Name to use when creating the symbolic link. Defaults to 'current.log'
63
+ *
64
+ * - `audit_hash_type` Use specified hashing algorithm for audit. Defaults to 'md5'. Use 'sha256' for FIPS compliance.
52
65
  *
53
66
  * To use with Express / Connect, use as below.
54
67
  *
@@ -117,7 +130,7 @@ var _checkDailyAndTest = function (freqType) {
117
130
  * @returns {*}
118
131
  */
119
132
  FileStreamRotator.getFrequency = function (frequency) {
120
- var _f = frequency.toLowerCase().match(/^(\d+)([m|h])$/)
133
+ var _f = frequency.toLowerCase().match(/^(\d+)([mh])$/)
121
134
  if(_f){
122
135
  return _checkNumAndType(_f[2], parseInt(_f[1]));
123
136
  }
@@ -137,7 +150,7 @@ FileStreamRotator.getFrequency = function (frequency) {
137
150
  */
138
151
  FileStreamRotator.parseFileSize = function (size) {
139
152
  if(size && typeof size == "string"){
140
- var _s = size.toLowerCase().match(/^((?:0\.)?\d+)([k|m|g])$/);
153
+ var _s = size.toLowerCase().match(/^((?:0\.)?\d+)([kmg])$/);
141
154
  if(_s){
142
155
  switch(_s[2]){
143
156
  case 'k':
@@ -156,27 +169,29 @@ FileStreamRotator.parseFileSize = function (size) {
156
169
  * Returns date string for a given format / date_format
157
170
  * @param format
158
171
  * @param date_format
172
+ * @param {boolean} utc
159
173
  * @returns {string}
160
174
  */
161
- FileStreamRotator.getDate = function (format, date_format) {
175
+ FileStreamRotator.getDate = function (format, date_format, utc) {
162
176
  date_format = date_format || DATE_FORMAT;
177
+ let currentMoment = utc ? moment.utc() : moment().local()
163
178
  if (format && staticFrequency.indexOf(format.type) !== -1) {
164
179
  switch (format.type) {
165
180
  case 'm':
166
- var minute = Math.floor(moment().minutes() / format.digit) * format.digit;
167
- return moment().minutes(minute).format(date_format);
181
+ var minute = Math.floor(currentMoment.minutes() / format.digit) * format.digit;
182
+ return currentMoment.minutes(minute).format(date_format);
168
183
  break;
169
184
  case 'h':
170
- var hour = Math.floor(moment().hour() / format.digit) * format.digit;
171
- return moment().hour(hour).format(date_format);
185
+ var hour = Math.floor(currentMoment.hour() / format.digit) * format.digit;
186
+ return currentMoment.hour(hour).format(date_format);
172
187
  break;
173
188
  case 'daily':
174
189
  case 'custom':
175
190
  case 'test':
176
- return moment().format(date_format);
191
+ return currentMoment.format(date_format);
177
192
  }
178
193
  }
179
- return moment().format(date_format);
194
+ return currentMoment.format(date_format);
180
195
  }
181
196
 
182
197
  /**
@@ -190,6 +205,7 @@ FileStreamRotator.getDate = function (format, date_format) {
190
205
  * @property {Number} auditLogSettings.keep.amount
191
206
  * @property {String} auditLogSettings.auditLog
192
207
  * @property {Array} auditLogSettings.files
208
+ * @property {String} auditLogSettings.hashType
193
209
  */
194
210
  FileStreamRotator.setAuditLog = function (max_logs, audit_file, log_file){
195
211
  var _rtn = null;
@@ -239,13 +255,17 @@ FileStreamRotator.setAuditLog = function (max_logs, audit_file, log_file){
239
255
  * @param {Number} audit.keep.amount
240
256
  * @param {String} audit.auditLog
241
257
  * @param {Array} audit.files
258
+ * @param {String} audit.hashType
259
+ * @param {Boolean} verbose
242
260
  */
243
- FileStreamRotator.writeAuditLog = function(audit){
261
+ FileStreamRotator.writeAuditLog = function(audit, verbose){
244
262
  try{
245
263
  mkDirForFile(audit.auditLog);
246
264
  fs.writeFileSync(audit.auditLog, JSON.stringify(audit,null,4));
247
265
  }catch(e){
248
- console.error(new Date(),"[FileStreamRotator] Failed to store log audit at:", audit.auditLog,"Error:", e);
266
+ if (verbose) {
267
+ console.error(new Date(),"[FileStreamRotator] Failed to store log audit at:", audit.auditLog,"Error:", e);
268
+ }
249
269
  }
250
270
  };
251
271
 
@@ -256,19 +276,83 @@ FileStreamRotator.writeAuditLog = function(audit){
256
276
  * @param file.hash
257
277
  * @param file.name
258
278
  * @param file.date
279
+ * @param file.hashType
280
+ * @param {Boolean} verbose
259
281
  */
260
- function removeFile(file){
261
- if(file.hash === crypto.createHash('md5').update(file.name + "LOG_FILE" + file.date).digest("hex")){
282
+ function removeFile(file, verbose){
283
+ if(file.hash === crypto.createHash(file.hashType).update(file.name + "LOG_FILE" + file.date).digest("hex")){
262
284
  try{
263
285
  if (fs.existsSync(file.name)) {
264
286
  fs.unlinkSync(file.name);
265
287
  }
266
288
  }catch(e){
267
- console.error(new Date(), "[FileStreamRotator] Could not remove old log file: ", file.name);
289
+ if (verbose) {
290
+ console.error(new Date(), "[FileStreamRotator] Could not remove old log file: ", file.name);
291
+ }
292
+ }
293
+ }
294
+ }
295
+
296
+ /**
297
+ * Create symbolic link to current log file
298
+ * @param {String} logfile
299
+ * @param {String} name Name to use for symbolic link
300
+ * @param {Boolean} verbose
301
+ */
302
+ function createCurrentSymLink(logfile, name, verbose) {
303
+ let symLinkName = name || "current.log"
304
+ let logPath = path.dirname(logfile)
305
+ let logfileName = path.basename(logfile)
306
+ let current = logPath + "/" + symLinkName
307
+ try {
308
+ let stats = fs.lstatSync(current)
309
+ if(stats.isSymbolicLink()){
310
+ fs.unlinkSync(current)
311
+ fs.symlinkSync(logfileName, current)
312
+ }
313
+ } catch (err) {
314
+ if(err && err.code == "ENOENT") {
315
+ try {
316
+ fs.symlinkSync(logfileName, current)
317
+ } catch (e) {
318
+ if (verbose) {
319
+ console.error(new Date(), "[FileStreamRotator] Could not create symlink file: ", current, ' -> ', logfileName);
320
+ }
321
+ }
268
322
  }
269
323
  }
270
324
  }
271
325
 
326
+ /**
327
+ *
328
+ * @param {String} logfile
329
+ * @param {Boolean} verbose
330
+ * @param {function} cb
331
+ */
332
+ function createLogWatcher(logfile, verbose, cb){
333
+ if(!logfile) return null
334
+ // console.log("Creating log watcher")
335
+ try {
336
+ let stats = fs.lstatSync(logfile)
337
+ return fs.watch(logfile, function(event,filename){
338
+ // console.log(Date(), event, filename)
339
+ if(event == "rename"){
340
+ try {
341
+ let stats = fs.lstatSync(logfile)
342
+ // console.log("STATS:", stats)
343
+ }catch(err){
344
+ // console.log("ERROR:", err)
345
+ cb(err,logfile)
346
+ }
347
+ }
348
+ })
349
+ }catch(err){
350
+ if(verbose){
351
+ console.log(new Date(),"[FileStreamRotator] Could not add watcher for " + logfile);
352
+ }
353
+ }
354
+ }
355
+
272
356
  /**
273
357
  * Write audit json object to disk
274
358
  * @param {String} logfile
@@ -277,9 +361,12 @@ function removeFile(file){
277
361
  * @param {Boolean} audit.keep.days
278
362
  * @param {Number} audit.keep.amount
279
363
  * @param {String} audit.auditLog
364
+ * @param {String} audit.hashType
280
365
  * @param {Array} audit.files
366
+ * @param {EventEmitter} stream
367
+ * @param {Boolean} verbose
281
368
  */
282
- FileStreamRotator.addLogToAudit = function(logfile, audit){
369
+ FileStreamRotator.addLogToAudit = function(logfile, audit, stream, verbose){
283
370
  if(audit && audit.files){
284
371
  // Based on contribution by @nickbug - https://github.com/nickbug
285
372
  var index = audit.files.findIndex(function(file) {
@@ -293,7 +380,7 @@ FileStreamRotator.addLogToAudit = function(logfile, audit){
293
380
  audit.files.push({
294
381
  date: time,
295
382
  name: logfile,
296
- hash: crypto.createHash('md5').update(logfile + "LOG_FILE" + time).digest("hex")
383
+ hash: crypto.createHash(audit.hashType).update(logfile + "LOG_FILE" + time).digest("hex")
297
384
  });
298
385
 
299
386
  if(audit.keep.days){
@@ -302,7 +389,9 @@ FileStreamRotator.addLogToAudit = function(logfile, audit){
302
389
  if(file.date > oldestDate){
303
390
  return true;
304
391
  }
305
- removeFile(file);
392
+ file.hashType = audit.hashType
393
+ removeFile(file, verbose);
394
+ stream.emit("logRemoved", file)
306
395
  return false;
307
396
  });
308
397
  audit.files = recentFiles;
@@ -310,14 +399,16 @@ FileStreamRotator.addLogToAudit = function(logfile, audit){
310
399
  var filesToKeep = audit.files.splice(-audit.keep.amount);
311
400
  if(audit.files.length > 0){
312
401
  audit.files.filter(function(file){
313
- removeFile(file);
402
+ file.hashType = audit.hashType
403
+ removeFile(file, verbose);
404
+ stream.emit("logRemoved", file)
314
405
  return false;
315
406
  })
316
407
  }
317
408
  audit.files = filesToKeep;
318
409
  }
319
410
 
320
- FileStreamRotator.writeAuditLog(audit);
411
+ FileStreamRotator.writeAuditLog(audit, verbose);
321
412
  }
322
413
 
323
414
  return audit;
@@ -334,6 +425,12 @@ FileStreamRotator.addLogToAudit = function(logfile, audit){
334
425
  * @param options.max_logs
335
426
  * @param options.audit_file
336
427
  * @param options.file_options
428
+ * @param options.utc
429
+ * @param options.extension File extension to be added at the end of the filename
430
+ * @param options.watch_log
431
+ * @param options.create_symlink
432
+ * @param options.symlink_name
433
+ * @param options.audit_hash_type Hash to be used to add to the audit log (md5, sha256)
337
434
  * @returns {Object} stream
338
435
  */
339
436
  FileStreamRotator.getStream = function (options) {
@@ -351,6 +448,11 @@ FileStreamRotator.getStream = function (options) {
351
448
  }
352
449
 
353
450
  let auditLog = self.setAuditLog(options.max_logs, options.audit_file, options.filename);
451
+ // Thanks to Means88 for PR.
452
+ if (auditLog != null) {
453
+ auditLog.hashType = (options.audit_hash_type !== undefined ? options.audit_hash_type : 'md5');
454
+ }
455
+ self.verbose = (options.verbose !== undefined ? options.verbose : true);
354
456
 
355
457
  var fileSize = null;
356
458
  var fileCount = 0;
@@ -364,8 +466,8 @@ FileStreamRotator.getStream = function (options) {
364
466
  if(!options.date_format){
365
467
  dateFormat = "YYYY-MM-DD";
366
468
  }
367
- if(moment().format(dateFormat) != moment().add(2,"hours").format(dateFormat) || moment().format(dateFormat) == moment().add(1,"day").format(dateFormat)){
368
- if(options.verbose){
469
+ if(moment().format(dateFormat) != moment().endOf("day").format(dateFormat) || moment().format(dateFormat) == moment().add(1,"day").format(dateFormat)){
470
+ if(self.verbose){
369
471
  console.log(new Date(),"[FileStreamRotator] Changing type to custom as date format changes more often than once a day or not every day");
370
472
  }
371
473
  frequencyMetaData.type = "custom";
@@ -373,18 +475,16 @@ FileStreamRotator.getStream = function (options) {
373
475
  }
374
476
 
375
477
  if (frequencyMetaData) {
376
- curDate = (options.frequency ? self.getDate(frequencyMetaData,dateFormat) : "");
478
+ curDate = (options.frequency ? self.getDate(frequencyMetaData,dateFormat, options.utc) : "");
377
479
  }
378
480
 
481
+ options.create_symlink = options.create_symlink || false;
482
+ options.extension = options.extension || ""
379
483
  var filename = options.filename;
380
484
  var oldFile = null;
381
485
  var logfile = filename + (curDate ? "." + curDate : "");
382
486
  if(filename.match(/%DATE%/)){
383
- logfile = filename.replace(/%DATE%/g,(curDate?curDate:self.getDate(null,dateFormat)));
384
- }
385
- var verbose = (options.verbose !== undefined ? options.verbose : true);
386
- if (verbose) {
387
- console.log(new Date(),"[FileStreamRotator] Logging to: ", logfile);
487
+ logfile = filename.replace(/%DATE%/g,(curDate?curDate:self.getDate(null,dateFormat, options.utc)));
388
488
  }
389
489
 
390
490
  if(fileSize){
@@ -394,7 +494,7 @@ FileStreamRotator.getStream = function (options) {
394
494
  if(auditLog && auditLog.files && auditLog.files instanceof Array && auditLog.files.length > 0){
395
495
  var lastEntry = auditLog.files[auditLog.files.length - 1].name;
396
496
  if(lastEntry.match(t_log)){
397
- var lastCount = lastEntry.match(t_log + "\\.(\\d+)$");
497
+ var lastCount = lastEntry.match(t_log + "\\.(\\d+)");
398
498
  // Thanks for the PR contribution from @andrefarzat - https://github.com/andrefarzat
399
499
  if(lastCount){
400
500
  t_log = lastEntry;
@@ -402,10 +502,15 @@ FileStreamRotator.getStream = function (options) {
402
502
  }
403
503
  }
404
504
  }
505
+
506
+ if (fileCount == 0 && t_log == logfile) {
507
+ t_log += options.extension
508
+ }
509
+
405
510
  while(f = fs.existsSync(t_log)){
406
511
  lastLogFile = t_log;
407
512
  fileCount++;
408
- t_log = logfile + "." + fileCount;
513
+ t_log = logfile + "." + fileCount + options.extension;
409
514
  }
410
515
  if(lastLogFile){
411
516
  var lastLogFileStats = fs.statSync(lastLogFile);
@@ -416,15 +521,21 @@ FileStreamRotator.getStream = function (options) {
416
521
  }
417
522
  }
418
523
  logfile = t_log;
524
+ } else {
525
+ logfile += options.extension
526
+ }
527
+
528
+ if (self.verbose) {
529
+ console.log(new Date(),"[FileStreamRotator] Logging to: ", logfile);
419
530
  }
420
531
 
421
532
  mkDirForFile(logfile);
422
533
 
423
534
  var file_options = options.file_options || {flags: 'a'};
424
535
  var rotateStream = fs.createWriteStream(logfile, file_options);
425
- if (curDate && frequencyMetaData && (staticFrequency.indexOf(frequencyMetaData.type) > -1)) {
426
- if (verbose) {
427
- console.log(new Date(),"[FileStreamRotator] Rotating file: ", frequencyMetaData.type);
536
+ if ((curDate && frequencyMetaData && (staticFrequency.indexOf(frequencyMetaData.type) > -1)) || fileSize > 0) {
537
+ if (self.verbose) {
538
+ console.log(new Date(),"[FileStreamRotator] Rotating file: ", frequencyMetaData?frequencyMetaData.type:"", fileSize?"size: " + fileSize:"");
428
539
  }
429
540
  var stream = new EventEmitter();
430
541
  stream.auditLog = auditLog;
@@ -433,30 +544,71 @@ FileStreamRotator.getStream = function (options) {
433
544
  };
434
545
  BubbleEvents(rotateStream,stream);
435
546
 
547
+ stream.on('close', function(){
548
+ if (logWatcher) {
549
+ logWatcher.close()
550
+ }
551
+ })
552
+
436
553
  stream.on("new",function(newLog){
437
- stream.auditLog = self.addLogToAudit(newLog,stream.auditLog);
554
+ // console.log("new log", newLog)
555
+ stream.auditLog = self.addLogToAudit(newLog,stream.auditLog, stream, self.verbose)
556
+ if(options.create_symlink){
557
+ createCurrentSymLink(newLog, options.symlink_name, self.verbose)
558
+ }
559
+ if(options.watch_log){
560
+ stream.emit("addWatcher", newLog)
561
+ }
562
+ });
563
+
564
+ var logWatcher;
565
+ stream.on("addWatcher", function(newLog){
566
+ if (logWatcher) {
567
+ logWatcher.close()
568
+ }
569
+ if(!options.watch_log){
570
+ return
571
+ }
572
+ // console.log("ADDING WATCHER", newLog)
573
+ logWatcher = createLogWatcher(newLog, self.verbose, function(err,newLog){
574
+ stream.emit('createLog', newLog)
575
+ })
576
+ })
438
577
 
578
+ stream.on("createLog",function(file){
579
+ try {
580
+ let stats = fs.lstatSync(file)
581
+ }catch(err){
582
+ if(rotateStream && rotateStream.end == "function"){
583
+ rotateStream.end();
584
+ }
585
+ rotateStream = fs.createWriteStream(file, file_options);
586
+ stream.emit('new',file);
587
+ BubbleEvents(rotateStream,stream);
588
+ }
439
589
  });
440
590
 
591
+
441
592
  stream.write = (function (str, encoding) {
442
- var newDate = this.getDate(frequencyMetaData,dateFormat);
593
+ var newDate = frequencyMetaData ? this.getDate(frequencyMetaData, dateFormat, options.utc) : curDate;
443
594
  if (newDate != curDate || (fileSize && curSize > fileSize)) {
444
- var newLogfile = filename + (curDate ? "." + newDate : "");
595
+ var newLogfile = filename + (curDate && frequencyMetaData ? "." + newDate : "");
445
596
  if(filename.match(/%DATE%/) && curDate){
446
597
  newLogfile = filename.replace(/%DATE%/g,newDate);
447
598
  }
448
599
 
449
600
  if(fileSize && curSize > fileSize){
450
601
  fileCount++;
451
- newLogfile += "." + fileCount;
602
+ newLogfile += "." + fileCount + options.extension;
452
603
  }else{
453
604
  // reset file count
454
605
  fileCount = 0;
606
+ newLogfile += options.extension
455
607
  }
456
608
  curSize = 0;
457
609
 
458
- if (verbose) {
459
- console.log(new Date(),"[FileStreamRotator] Changing logs from %s to %s", logfile, newLogfile);
610
+ if (self.verbose) {
611
+ console.log(new Date(),require('util').format("[FileStreamRotator] Changing logs from %s to %s", logfile, newLogfile));
460
612
  }
461
613
  curDate = newDate;
462
614
  oldFile = logfile;
@@ -482,10 +634,11 @@ FileStreamRotator.getStream = function (options) {
482
634
  process.nextTick(function(){
483
635
  stream.emit('new',logfile);
484
636
  })
637
+ stream.emit('new',logfile)
485
638
  return stream;
486
639
  } else {
487
- if (verbose) {
488
- console.log(new Date(),"[FileStreamRotator] File won't be rotated: ", options.frequency, frequencyMetaData && frequencyMetaData.type);
640
+ if (self.verbose) {
641
+ console.log(new Date(),"[FileStreamRotator] File won't be rotated: ", options.frequency, options.size);
489
642
  }
490
643
  process.nextTick(function(){
491
644
  rotateStream.emit('new',logfile);
@@ -512,7 +665,13 @@ var mkDirForFile = function(pathWithFile){
512
665
  // console.log("STATS ERROR",e)
513
666
  // }
514
667
  if (!fs.existsSync(fullPath)) {
515
- fs.mkdirSync(fullPath);
668
+ try{
669
+ fs.mkdirSync(fullPath);
670
+ }catch(e){
671
+ if(e.code !== 'EEXIST'){
672
+ throw e;
673
+ }
674
+ }
516
675
  }
517
676
  return fullPath;
518
677
  },
@@ -0,0 +1,17 @@
1
+ The MIT License (MIT)
2
+ Copyright © 2022 Roger Castells
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
5
+ associated documentation files (the “Software”), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to
8
+ the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all copies or substantial
11
+ portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
14
+ LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
15
+ NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
16
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
17
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -33,7 +33,14 @@ npm install file-stream-rotator
33
33
  stream in a loop, if the application terminates or log rotates, data pending to be flushed might be lost.
34
34
  - *file_options* An object passed to the stream. This can be used to specify flags, encoding, and mode.
35
35
  See https://nodejs.org/api/fs.html#fs_fs_createwritestream_path_options. Default `{ flags: 'a' }`.
36
-
36
+ - *utc* Use UTC time for date in filename. Defaults to 'FALSE'
37
+ - *extension* File extension to be appended to the filename. This is useful when using size restrictions as the rotation
38
+ adds a count (1,2,3,4,...) at the end of the filename when the required size is met.
39
+ - *watch_log* Watch the current file being written to and recreate it in case of accidental deletion. Defaults to 'FALSE'
40
+ - *create_symlink* Create a tailable symlink to the current active log file. Defaults to 'FALSE'
41
+ - *symlink_name* Name to use when creating the symbolic link. Defaults to 'current.log'
42
+ - *audit_hash_type* Use specified hashing algorithm for audit. Defaults to 'md5'. Use 'sha256' for FIPS compliance.
43
+
37
44
 
38
45
  ## Example Usage
39
46
  ```javascript
@@ -70,6 +77,13 @@ npm install file-stream-rotator
70
77
  // Rotate on the hour or any specified number of hours and keep 10 days and store the audit file in /tmp/log-audit.json
71
78
  var rotatingLogStream = require('file-stream-rotator').getStream({filename:"/tmp/test.log", frequency:"1h", verbose: false, max_logs: "10d", audit_file: "/tmp/log-audit.json"});
72
79
 
80
+ // Rotate by file size only without date included in the name. Iteration will be added at the end.
81
+ var rotatingLogStream = require('file-stream-rotator').getStream({filename:"/tmp/logfile", size:"50k", max_logs: "5", audit_file:"/tmp/logaudit.json"});
82
+
83
+ // Rotate by file size only without date included in the name. Rotation added before the extension.
84
+ var rotatingLogStream = require('file-stream-rotator').getStream({filename:"/tmp/logfile", size:"50k", max_logs: "5", audit_file:"/tmp/logaudit.json". extension: ".log"});
85
+
86
+
73
87
  //.....
74
88
 
75
89
  // Use new stream in express
@@ -83,6 +97,7 @@ You can listen to the *open*, *close*, *error* and *finish* events generated by
83
97
 
84
98
  * *rotate*: that will pass two parameters to the callback: (*oldFilename*, *newFilename*)
85
99
  * *new*: that will pass one parameter to the callback: *newFilename*
100
+ * *logRemoved*: that will pass one parameter to the callback: {*date*: unix_timestamp, *name*: filename_deleted, *hash*: log_file_unique_idenfifier}
86
101
 
87
102
  You can also limit the size of each file by adding the size option using "k", "m" and "g" to specify the size of the file in kiloybytes, megabytes or gigabytes. When it rotates a file based on size, it will add a number to the end and increment it for every time the file rotates in the given period as shown below.
88
103
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "file-stream-rotator",
3
- "version": "0.4.1",
3
+ "version": "0.6.1",
4
4
  "description": "Automated stream rotation useful for log files",
5
5
  "main": "FileStreamRotator.js",
6
6
  "scripts": {
@@ -25,10 +25,10 @@
25
25
  "author": "Roger Castells",
26
26
  "license": "MIT",
27
27
  "dependencies": {
28
- "moment": "^2.11.2"
28
+ "moment": "^2.29.1"
29
29
  }
30
30
 
31
- ,"_resolved": "https://registry.npmjs.org/file-stream-rotator/-/file-stream-rotator-0.4.1.tgz"
32
- ,"_integrity": "sha512-W3aa3QJEc8BS2MmdVpQiYLKHj3ijpto1gMDlsgCRSKfIUe6MwkcpODGPQ3vZfb0XvCeCqlu9CBQTN7oQri2TZQ=="
33
- ,"_from": "file-stream-rotator@0.4.1"
31
+ ,"_resolved": "https://registry.npmjs.org/file-stream-rotator/-/file-stream-rotator-0.6.1.tgz"
32
+ ,"_integrity": "sha512-u+dBid4PvZw17PmDeRcNOtCP9CCK/9lRN2w+r1xIS7yOL9JFrIBKTvrYsxT4P0pGtThYTn++QS5ChHaUov3+zQ=="
33
+ ,"_from": "file-stream-rotator@0.6.1"
34
34
  }
@@ -4,15 +4,24 @@ var moment = require('moment');
4
4
  // var rotatingLogStream = require('../FileStreamRotator').getStream({filename:"/tmp/testlog-%DATE%.log", frequency:"dont-rotate", verbose: true, date_format: "YYYY-MM-DD.HH.mm.ss"});
5
5
  // var rotatingLogStream = require('../FileStreamRotator').getStream({filename:"/tmp/testlog-%DATE%.log", frequency:"daily", verbose: true, date_format: "YYYYMMDD"});
6
6
  // var rotatingLogStream = require('../FileStreamRotator').getStream({filename:"/tmp/testlog-%DATE%.log", frequency:"daily", verbose: true});
7
+
8
+ const symLinkName = "tail.log"
9
+
7
10
  var rotatingLogStream = require('../FileStreamRotator').getStream({
8
- filename: "/tmp/a/logs/1m/testlog-%DATE%.log",
11
+ filename: "logs/1m/testlog-%DATE%",
9
12
  frequency: "1m",
10
13
  verbose: true,
11
14
  date_format: "YYYY-MM-DD.HH.mm",
12
- size: "50k",
15
+ size: "100k",
13
16
  max_logs: "10",
14
17
  audit_file: "/tmp/audit.json",
15
- end_stream: false
18
+ end_stream: false,
19
+ utc: true,
20
+ extension: ".log",
21
+ create_symlink: true,
22
+ watch_log: true,
23
+ // symlink_name: "tail.log"
24
+ symlink_name: symLinkName
16
25
  });
17
26
 
18
27
  rotatingLogStream.on("error", function () {
@@ -40,29 +49,37 @@ rotatingLogStream.on("new", function (newFile) {
40
49
  console.log(Date.now(), Date(), "stream new", newFile);
41
50
  })
42
51
 
52
+ rotatingLogStream.on("logRemoved", function (newFile) {
53
+ console.log(Date.now(), Date(), "stream logRemoved", newFile);
54
+ })
55
+
43
56
  // console.log(rotatingLogStream.on, rotatingLogStream.end, rotatingLogStream)
44
57
 
45
58
 
46
- var rotatingLogStream1 = require('../FileStreamRotator').getStream({
47
- filename: "/tmp/a/logs/1m-1/testlog-%DATE%.log",
48
- frequency: "1m",
49
- verbose: true,
50
- date_format: "YYYY-MM-DD.HH.mm",
51
- size: "50k",
52
- max_logs: "10",
53
- audit_file: "/tmp/audit-1.json",
54
- end_stream: false
55
- });
59
+ // var rotatingLogStream1 = require('../FileStreamRotator').getStream({
60
+ // filename: "/tmp/a/logs/1m-1/testlog-%DATE%.log",
61
+ // frequency: "1m",
62
+ // verbose: true,
63
+ // date_format: "YYYY-MM-DD.HH.mm",
64
+ // size: "50k",
65
+ // max_logs: "10",
66
+ // audit_file: "/tmp/audit-1.json",
67
+ // end_stream: false
68
+ // });
56
69
 
57
70
  var counter = 0;
58
71
  var i = setInterval(function () {
59
72
  counter++;
60
73
  rotatingLogStream.write(Date() + "\t" + "testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890\n")
61
- rotatingLogStream1.write(Date() + "\t" + "testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890\n")
74
+ // rotatingLogStream1.write(Date() + "\t" + "testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890-testing 1234567890\n")
62
75
  if (counter == 5000) {
63
76
  clearInterval(i);
64
77
  rotatingLogStream.end("end\n");
65
- rotatingLogStream1.end("end\n");
78
+ // rotatingLogStream1.end("end\n");
66
79
  }
67
80
  }, 10);
68
81
 
82
+ // var i = setTimeout(function () {
83
+ // rotatingLogStream.emit("createLog")
84
+ // }, 10000);
85
+