-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathwinston+3.1.0.patch
254 lines (241 loc) · 7.32 KB
/
winston+3.1.0.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
diff --git a/node_modules/winston/lib/winston.js b/node_modules/winston/lib/winston.js
index b396a3a..f44efb7 100644
--- a/node_modules/winston/lib/winston.js
+++ b/node_modules/winston/lib/winston.js
@@ -74,89 +74,6 @@ winston.Transport = require('winston-transport');
*/
winston.loggers = new winston.Container();
-/**
- * We create and expose a 'defaultLogger' so that the programmer may do the
- * following without the need to create an instance of winston.Logger directly:
- * @example
- * const winston = require('winston');
- * winston.log('info', 'some message');
- * winston.error('some error');
- */
-const defaultLogger = winston.createLogger();
-
-// Pass through the target methods onto `winston.
-Object.keys(winston.config.npm.levels).concat([
- 'log',
- 'query',
- 'stream',
- 'add',
- 'remove',
- 'clear',
- 'profile',
- 'startTimer',
- 'handleExceptions',
- 'unhandleExceptions',
- 'configure'
-]).forEach(method => (
- winston[method] = (...args) => defaultLogger[method](...args)
-));
-
-/**
- * Define getter / setter for the default logger level which need to be exposed
- * by winston.
- * @type {string}
- */
-Object.defineProperty(winston, 'level', {
- get() {
- return defaultLogger.level;
- },
- set(val) {
- defaultLogger.level = val;
- }
-});
-
-/**
- * Define getter for `exceptions` which replaces `handleExceptions` and
- * `unhandleExceptions`.
- * @type {Object}
- */
-Object.defineProperty(winston, 'exceptions', {
- get() {
- return defaultLogger.exceptions;
- }
-});
-
-/**
- * Define getters / setters for appropriate properties of the default logger
- * which need to be exposed by winston.
- * @type {Logger}
- */
-[
- 'exitOnError'
-].forEach(prop => {
- Object.defineProperty(winston, prop, {
- get() {
- return defaultLogger[prop];
- },
- set(val) {
- defaultLogger[prop] = val;
- }
- });
-});
-
-/**
- * The default transports and exceptionHandlers for the default winston logger.
- * @type {Object}
- */
-Object.defineProperty(winston, 'default', {
- get() {
- return {
- exceptionHandlers: defaultLogger.exceptionHandlers,
- transports: defaultLogger.transports
- };
- }
-});
-
// Have friendlier breakage notices for properties that were exposed by default
// on winston < 3.0.
warn.deprecated(winston, 'setLevels');
diff --git a/node_modules/winston/lib/winston/exception-stream.js b/node_modules/winston/lib/winston/exception-stream.js
index 5afdeb2..d7a5833 100644
--- a/node_modules/winston/lib/winston/exception-stream.js
+++ b/node_modules/winston/lib/winston/exception-stream.js
@@ -7,14 +7,14 @@
'use strict';
-const Writable = require('readable-stream/writable');
+const { Writable } = require('stream');
/**
* TODO: add class description.
* @type {ExceptionStream}
* @extends {Writable}
*/
-module.exports = class ExceptionStream extends Writable {
+module.exports = class ExceptionStream {
/**
* Constructor function for the ExceptionStream responsible for wrapping a
* TransportStream; only allowing writes of `info` objects with
@@ -22,7 +22,7 @@ module.exports = class ExceptionStream extends Writable {
* @param {!TransportStream} transport - Stream to filter to exceptions
*/
constructor(transport) {
- super({ objectMode: true });
+ Writable.call(this, { objectMode: true });
if (!transport) {
throw new Error('ExceptionStream requires a TransportStream instance.');
diff --git a/node_modules/winston/lib/winston/logger.js b/node_modules/winston/lib/winston/logger.js
index f206f1a..2964c02 100644
--- a/node_modules/winston/lib/winston/logger.js
+++ b/node_modules/winston/lib/winston/logger.js
@@ -7,7 +7,7 @@
'use strict';
-const stream = require('readable-stream');
+const stream = require('stream');
const asyncForEach = require('async/forEach');
const { LEVEL, SPLAT } = require('triple-beam');
const isStream = require('is-stream');
@@ -22,14 +22,14 @@ const config = require('./config');
* @type {Logger}
* @extends {stream.Transform}
*/
-class Logger extends stream.Transform {
+class Logger {
/**
* Constructor function for the Logger object responsible for persisting log
* messages and metadata to one or more transports.
* @param {!Object} options - foo
*/
constructor(options) {
- super({
+ stream.Transform.call(this, {
objectMode: true
});
this.configure(options);
diff --git a/node_modules/winston/lib/winston/tail-file.js b/node_modules/winston/lib/winston/tail-file.js
index 9870150..0e07cb8 100644
--- a/node_modules/winston/lib/winston/tail-file.js
+++ b/node_modules/winston/lib/winston/tail-file.js
@@ -9,7 +9,7 @@
const fs = require('fs');
const { StringDecoder } = require('string_decoder');
-const { Stream } = require('readable-stream');
+const { Stream } = require('stream');
/**
* Simple no-op function.
diff --git a/node_modules/winston/lib/winston/transports/file.js b/node_modules/winston/lib/winston/transports/file.js
index fa68e6d..4b2646c 100644
--- a/node_modules/winston/lib/winston/transports/file.js
+++ b/node_modules/winston/lib/winston/transports/file.js
@@ -12,7 +12,7 @@ const path = require('path');
const asyncSeries = require('async/series');
const zlib = require('zlib');
const { MESSAGE } = require('triple-beam');
-const { Stream, PassThrough } = require('readable-stream');
+const { Stream, PassThrough } = require('stream');
const TransportStream = require('winston-transport');
const debug = require('diagnostics')('winston:file');
const os = require('os');
diff --git a/node_modules/winston/lib/winston/transports/http.js b/node_modules/winston/lib/winston/transports/http.js
index 1e19815..aec5a42 100644
--- a/node_modules/winston/lib/winston/transports/http.js
+++ b/node_modules/winston/lib/winston/transports/http.js
@@ -9,7 +9,7 @@
const http = require('http');
const https = require('https');
-const { Stream } = require('readable-stream');
+const { Stream } = require('stream');
const TransportStream = require('winston-transport');
/**
diff --git a/node_modules/winston/lib/winston/transports/index.js b/node_modules/winston/lib/winston/transports/index.js
index f2f7cc3..f981b8a 100644
--- a/node_modules/winston/lib/winston/transports/index.js
+++ b/node_modules/winston/lib/winston/transports/index.js
@@ -7,50 +7,9 @@
'use strict';
-/**
- * TODO: add property description.
- * @type {Console}
- */
-Object.defineProperty(exports, 'Console', {
- configurable: true,
- enumerable: true,
- get() {
- return require('./console');
- }
-});
-
-/**
- * TODO: add property description.
- * @type {File}
- */
-Object.defineProperty(exports, 'File', {
- configurable: true,
- enumerable: true,
- get() {
- return require('./file');
- }
-});
-
-/**
- * TODO: add property description.
- * @type {Http}
- */
-Object.defineProperty(exports, 'Http', {
- configurable: true,
- enumerable: true,
- get() {
- return require('./http');
- }
-});
-
-/**
- * TODO: add property description.
- * @type {Stream}
- */
-Object.defineProperty(exports, 'Stream', {
- configurable: true,
- enumerable: true,
- get() {
- return require('./stream');
- }
-});
+// Eagerly require() and export the modules because these will become a part of
+// the V8 snapshot.
+module.exports.Console = require('./console');
+module.exports.File = require('./file');
+module.exports.Http = require('./http');
+module.exports.Stream = require('./stream');