Skip to content
This repository
Browse code

[minor] Fix whitespaces

  • Loading branch information...
commit 0f660abff5267d4abf9d393ad948cd40657751a0 1 parent e80c531
Pavan Kumar Sunkara authored April 15, 2012
36  lib/winston.js
@@ -19,7 +19,7 @@ require('pkginfo')(module, 'version');
19 19
 winston.transports = require('./winston/transports');
20 20
 
21 21
 //
22  
-// Expose utility methods 
  22
+// Expose utility methods
23 23
 //
24 24
 var common             = require('./winston/common');
25 25
 winston.hash           = common.hash;
@@ -27,7 +27,7 @@ winston.clone          = common.clone;
27 27
 winston.longestElement = common.longestElement;
28 28
 winston.exception      = require('./winston/exception');
29 29
 winston.config         = require('./winston/config');
30  
-winston.addColors      = winston.config.addColors; 
  30
+winston.addColors      = winston.config.addColors;
31 31
 
32 32
 //
33 33
 // Expose core Logging-related prototypes.
@@ -37,7 +37,7 @@ winston.Logger         = require('./winston/logger').Logger;
37 37
 winston.Transport      = require('./winston/transports/transport').Transport;
38 38
 
39 39
 //
40  
-// We create and expose a default `Container` to `winston.loggers` so that the 
  40
+// We create and expose a default `Container` to `winston.loggers` so that the
41 41
 // programmer may manage multiple `winston.Logger` instances without any additional overhead.
42 42
 //
43 43
 // ### some-file1.js
@@ -56,24 +56,24 @@ winston.loggers = new winston.Container();
56 56
 //
57 57
 //     var winston = require('winston');
58 58
 //     winston.log('info', 'some message');
59  
-//     winston.error('some error'); 
  59
+//     winston.error('some error');
60 60
 //
61  
-var defaultLogger = new winston.Logger({ 
62  
-  transports: [new winston.transports.Console()] 
  61
+var defaultLogger = new winston.Logger({
  62
+  transports: [new winston.transports.Console()]
63 63
 });
64 64
 
65 65
 //
66 66
 // Pass through the target methods onto `winston.
67 67
 //
68 68
 var methods = [
69  
-  'log', 
70  
-  'add', 
71  
-  'remove', 
72  
-  'profile', 
  69
+  'log',
  70
+  'add',
  71
+  'remove',
  72
+  'profile',
73 73
   'startTimer',
74  
-  'extend', 
75  
-  'cli', 
76  
-  'handleExceptions', 
  74
+  'extend',
  75
+  'cli',
  76
+  'handleExceptions',
77 77
   'unhandleExceptions'
78 78
 ];
79 79
 common.setLevels(winston, null, defaultLogger.levels);
@@ -94,12 +94,12 @@ winston.cli = function () {
94 94
   common.setLevels(winston, defaultLogger.levels, winston.config.cli.levels);
95 95
   defaultLogger.setLevels(winston.config.cli.levels);
96 96
   winston.config.addColors(winston.config.cli.colors);
97  
-  
  97
+
98 98
   if (defaultLogger.transports.console) {
99 99
     defaultLogger.transports.console.colorize = true;
100 100
     defaultLogger.transports.console.timestamp = false;
101 101
   }
102  
-  
  102
+
103 103
   return winston;
104 104
 };
105 105
 
@@ -114,7 +114,7 @@ winston.setLevels = function (target) {
114 114
 };
115 115
 
116 116
 //
117  
-// Define getters / setters for appropriate properties of the 
  117
+// Define getters / setters for appropriate properties of the
118 118
 // default logger which need to be exposed by winston.
119 119
 //
120 120
 ['emitErrs', 'exitOnError', 'padLevels', 'level', 'levelLength', 'stripColors'].forEach(function (prop) {
@@ -129,8 +129,8 @@ winston.setLevels = function (target) {
129 129
 });
130 130
 
131 131
 //
132  
-// @default {Object} 
133  
-// The default transports and exceptionHandlers for 
  132
+// @default {Object}
  133
+// The default transports and exceptionHandlers for
134 134
 // the default winston logger.
135 135
 //
136 136
 Object.defineProperty(winston, 'default', {
38  lib/winston/common.js
@@ -15,7 +15,7 @@ var util = require('util'),
15 15
 // #### @target {Object} Object on which to set levels.
16 16
 // #### @past {Object} Previous levels set on target.
17 17
 // #### @current {Object} Current levels to set on target.
18  
-// Create functions on the target objects for each level 
  18
+// Create functions on the target objects for each level
19 19
 // in current.levels. If past is defined, remove functions
20 20
 // for each of those levels.
21 21
 //
@@ -30,7 +30,7 @@ exports.setLevels = function (target, past, current, isDefault) {
30 30
   if (target.padLevels) {
31 31
     target.levelLength = exports.longestElement(Object.keys(target.levels));
32 32
   }
33  
-  
  33
+
34 34
   //
35 35
   //  Define prototype methods for each log level
36 36
   //  e.g. target.log('info', msg) <=> target.info(msg)
@@ -44,7 +44,7 @@ exports.setLevels = function (target, past, current, isDefault) {
44 44
       return target.log(level, msg, meta, callback);
45 45
     };
46 46
   });
47  
-  
  47
+
48 48
   return target;
49 49
 };
50 50
 
@@ -94,9 +94,9 @@ exports.clone = function (obj) {
94 94
 //
95 95
 // ### function log (options)
96 96
 // #### @options {Object} All information about the log serialization.
97  
-// Generic logging function for returning timestamped strings 
  97
+// Generic logging function for returning timestamped strings
98 98
 // with the following options:
99  
-// 
  99
+//
100 100
 //    {
101 101
 //      level:     'level to add to serialized message',
102 102
 //      message:   'message to serialize',
@@ -128,12 +128,12 @@ exports.log = function (options) {
128 128
     output         = meta || {};
129 129
     output.level   = options.level;
130 130
     output.message = options.message;
131  
-    
  131
+
132 132
     if (timestamp) {
133 133
       output.timestamp = timestamp;
134 134
     }
135 135
 
136  
-    return typeof options.stringify === 'function' 
  136
+    return typeof options.stringify === 'function'
137 137
       ? options.stringify(output)
138 138
       : JSON.stringify(output, function(key, value) {
139 139
     	  if (value instanceof Buffer) {
@@ -154,7 +154,7 @@ exports.log = function (options) {
154 154
     else if (Object.keys(meta).length > 0) {
155 155
       output += ' ' + exports.serialize(meta);
156 156
     }
157  
-  } 
  157
+  }
158 158
 
159 159
   return output;
160 160
 };
@@ -178,8 +178,8 @@ exports.hash = function (str) {
178 178
 // I wanted a universal lowercase header message, as opposed to the `DEBUG`
179 179
 // (i.e. all uppercase header) used only in `util.debug()`
180 180
 //
181  
-var months = ['Jan', 'Feb', 'Mar', 'Apr', 
182  
-              'May', 'Jun', 'Jul', 'Aug', 
  181
+var months = ['Jan', 'Feb', 'Mar', 'Apr',
  182
+              'May', 'Jun', 'Jul', 'Aug',
183 183
               'Sep', 'Oct', 'Nov', 'Dec'];
184 184
 
185 185
 //
@@ -201,7 +201,7 @@ exports.timestamp = function () {
201 201
     exports.pad(d.getMinutes()),
202 202
     exports.pad(d.getSeconds())
203 203
   ].join(':');
204  
-              
  204
+
205 205
   return [d.getDate(), months[d.getMonth()], time].join(' ');
206 206
 };
207 207
 
@@ -209,7 +209,7 @@ exports.timestamp = function () {
209 209
 // ### function serialize (obj, key)
210 210
 // #### @obj {Object|literal} Object to serialize
211 211
 // #### @key {string} **Optional** Optional key represented by obj in a larger object
212  
-// Performs simple comma-separated, `key=value` serialization for Loggly when 
  212
+// Performs simple comma-separated, `key=value` serialization for Loggly when
213 213
 // logging to non-JSON inputs.
214 214
 //
215 215
 exports.serialize = function (obj, key) {
@@ -222,7 +222,7 @@ exports.serialize = function (obj, key) {
222 222
   else if (obj === false) {
223 223
     obj = 'false';
224 224
   }
225  
-  
  225
+
226 226
   if (typeof obj !== 'object') {
227 227
     return key ? key + '=' + obj : obj;
228 228
   }
@@ -234,18 +234,18 @@ exports.serialize = function (obj, key) {
234 234
   var msg = '',
235 235
       keys = Object.keys(obj),
236 236
       length = keys.length;
237  
-  
  237
+
238 238
   for (var i = 0; i < length; i++) {
239 239
     if (Array.isArray(obj[keys[i]])) {
240 240
       msg += keys[i] + '=[';
241  
-      
  241
+
242 242
       for (var j = 0, l = obj[keys[i]].length; j < l; j++) {
243 243
         msg += exports.serialize(obj[keys[i]][j]);
244 244
         if (j < l - 1) {
245 245
           msg += ', ';
246 246
         }
247 247
       }
248  
-      
  248
+
249 249
       msg += ']';
250 250
     }
251 251
     else if (obj[keys[i]] instanceof Date) {
@@ -253,12 +253,12 @@ exports.serialize = function (obj, key) {
253 253
     }
254 254
     else {
255 255
       msg += exports.serialize(obj[keys[i]], keys[i]);
256  
-    }    
257  
-    
  256
+    }
  257
+
258 258
     if (i < length - 1) {
259 259
       msg += ', ';
260 260
     }
261 261
   }
262  
-  
  262
+
263 263
   return msg;
264 264
 };
4  lib/winston/config.js
... ...
@@ -1,5 +1,5 @@
1 1
 /*
2  
- * config.js: Default settings for all levels that winston knows about 
  2
+ * config.js: Default settings for all levels that winston knows about
3 3
  *
4 4
  * (C) 2010 Charlie Robbins
5 5
  * MIT LICENCE
@@ -8,7 +8,7 @@
8 8
 
9 9
 var colors = require('colors');
10 10
 
11  
-var config = exports, 
  11
+var config = exports,
12 12
     allColors = exports.allColors = {};
13 13
 
14 14
 config.addColors = function (colors) {
4  lib/winston/config/cli-config.js
... ...
@@ -1,11 +1,11 @@
1 1
 /*
2  
- * cli-config.js: Config that conform to commonly used CLI logging levels. 
  2
+ * cli-config.js: Config that conform to commonly used CLI logging levels.
3 3
  *
4 4
  * (C) 2010 Charlie Robbins
5 5
  * MIT LICENCE
6 6
  *
7 7
  */
8  
- 
  8
+
9 9
 var cliConfig = exports;
10 10
 
11 11
 cliConfig.levels = {
12  lib/winston/config/npm-config.js
... ...
@@ -1,19 +1,19 @@
1 1
 /*
2  
- * npm-config.js: Config that conform to npm logging levels. 
  2
+ * npm-config.js: Config that conform to npm logging levels.
3 3
  *
4 4
  * (C) 2010 Charlie Robbins
5 5
  * MIT LICENCE
6 6
  *
7 7
  */
8  
- 
  8
+
9 9
 var npmConfig = exports;
10 10
 
11 11
 npmConfig.levels = {
12  
-  silly: 0, 
13  
-  verbose: 1, 
14  
-  info: 2, 
  12
+  silly: 0,
  13
+  verbose: 1,
  14
+  info: 2,
15 15
   warn: 3,
16  
-  debug: 4, 
  16
+  debug: 4,
17 17
   error: 5
18 18
 };
19 19
 
14  lib/winston/config/syslog-config.js
... ...
@@ -1,19 +1,19 @@
1 1
 /*
2  
- * syslog-config.js: Config that conform to syslog logging levels. 
  2
+ * syslog-config.js: Config that conform to syslog logging levels.
3 3
  *
4 4
  * (C) 2010 Charlie Robbins
5 5
  * MIT LICENCE
6 6
  *
7 7
  */
8  
- 
  8
+
9 9
 var syslogConfig = exports;
10 10
 
11 11
 syslogConfig.levels = {
12  
-  debug: 0, 
13  
-  info: 1, 
14  
-  notice: 2, 
  12
+  debug: 0,
  13
+  info: 1,
  14
+  notice: 2,
15 15
   warning: 3,
16  
-  error: 4, 
  16
+  error: 4,
17 17
   crit: 5,
18 18
   alert: 6,
19 19
   emerg: 7
@@ -24,7 +24,7 @@ syslogConfig.colors = {
24 24
   info: 'green',
25 25
   notice: 'yellow',
26 26
   warning: 'red',
27  
-  error: 'red', 
  27
+  error: 'red',
28 28
   crit: 'red',
29 29
   alert: 'yellow',
30 30
   emerg: 'red'
12  lib/winston/container.js
@@ -33,7 +33,7 @@ var Container = exports.Container = function (options) {
33 33
 // #### @id {string} Id of the Logger to get
34 34
 // #### @options {Object} **Optional** Options for the Logger instance
35 35
 // Retreives a `winston.Logger` instance for the specified `id`. If
36  
-// an instance does not exist, one is created. 
  36
+// an instance does not exist, one is created.
37 37
 //
38 38
 Container.prototype.get = Container.prototype.add = function (id, options) {
39 39
   if (!this.loggers[id]) {
@@ -48,13 +48,13 @@ Container.prototype.get = Container.prototype.add = function (id, options) {
48 48
       if (key === 'transports') {
49 49
         return;
50 50
       }
51  
-      
  51
+
52 52
       var name = common.capitalize(key);
53 53
 
54 54
       if (!winston.transports[name]) {
55 55
         throw new Error('Cannot add unknown transport: ' + name);
56 56
       }
57  
-      
  57
+
58 58
       var namedOptions = options[key];
59 59
       namedOptions.id = id;
60 60
       options.transports.push(new (winston.transports[name])(namedOptions));
@@ -79,12 +79,12 @@ Container.prototype.has = function (id) {
79 79
 //
80 80
 // ### function close (id)
81 81
 // #### @id {string} **Optional** Id of the Logger instance to close
82  
-// Closes a `Logger` instance with the specified `id` if it exists. 
  82
+// Closes a `Logger` instance with the specified `id` if it exists.
83 83
 // If no `id` is supplied then all Loggers are closed.
84 84
 //
85 85
 Container.prototype.close = function (id) {
86 86
   var self = this;
87  
-  
  87
+
88 88
   function _close (id) {
89 89
     if (!self.loggers[id]) {
90 90
       return;
@@ -93,7 +93,7 @@ Container.prototype.close = function (id) {
93 93
     self.loggers[id].close();
94 94
     delete self.loggers[id];
95 95
   }
96  
-  
  96
+
97 97
   return id ? _close(id) : Object.keys(this.loggers).forEach(function (id) {
98 98
     _close(id);
99 99
   });
4  lib/winston/exception.js
@@ -5,10 +5,10 @@
5 5
  * MIT LICENCE
6 6
  *
7 7
  */
8  
- 
  8
+
9 9
 var os = require('os'),
10 10
     stackTrace = require('stack-trace');
11  
-    
  11
+
12 12
 var exception = exports;
13 13
 
14 14
 exception.getAllInfo = function (err) {
116  lib/winston/logger.js
@@ -5,7 +5,7 @@
5 5
  * MIT LICENCE
6 6
  *
7 7
  */
8  
- 
  8
+
9 9
 var events = require('events'),
10 10
     util = require('util'),
11 11
     async = require('async'),
@@ -27,10 +27,10 @@ var ticksPerMillisecond = 10000;
27 27
 var Logger = exports.Logger = function (options) {
28 28
   events.EventEmitter.call(this);
29 29
   options = options || {};
30  
-  
  30
+
31 31
   var self = this,
32 32
       handleExceptions = false;
33  
-  
  33
+
34 34
   //
35 35
   // Set Levels and default logging level
36 36
   //
@@ -39,17 +39,17 @@ var Logger = exports.Logger = function (options) {
39 39
   if (options.colors) {
40 40
     config.addColors(options.colors);
41 41
   }
42  
-  
  42
+
43 43
   //
44 44
   // Hoist other options onto this instance.
45 45
   //
46 46
   this.level       = options.level || 'info';
47 47
   this.emitErrs    = options.emitErrs || false;
48 48
   this.stripColors = options.stripColors || false;
49  
-  this.exitOnError = typeof options.exitOnError !== 'undefined' 
50  
-    ? options.exitOnError 
  49
+  this.exitOnError = typeof options.exitOnError !== 'undefined'
  50
+    ? options.exitOnError
51 51
     : true;
52  
-  
  52
+
53 53
   //
54 54
   // Setup other intelligent default settings.
55 55
   //
@@ -63,19 +63,19 @@ var Logger = exports.Logger = function (options) {
63 63
   if (options.transports) {
64 64
     options.transports.forEach(function (transport) {
65 65
       self.add(transport, null, true);
66  
-      
  66
+
67 67
       if (transport.handleExceptions) {
68 68
         handleExceptions = true;
69 69
       }
70 70
     });
71 71
   }
72  
-  
  72
+
73 73
   if (options.rewriters) {
74 74
     options.rewriters.forEach(function(rewriter) {
75 75
       self.addRewriter(rewriter);
76 76
     });
77 77
   }
78  
-  
  78
+
79 79
   if (options.exceptionHandlers) {
80 80
     handleExceptions = true;
81 81
     options.exceptionHandlers.forEach(function (handler) {
@@ -83,7 +83,7 @@ var Logger = exports.Logger = function (options) {
83 83
       self.exceptionHandlers[handler.name] = handler;
84 84
     });
85 85
   }
86  
-  
  86
+
87 87
   if (options.handleExceptions || handleExceptions) {
88 88
     this.handleExceptions();
89 89
   }
@@ -107,7 +107,7 @@ Logger.prototype.extend = function (target) {
107 107
       return self[method].apply(self, arguments);
108 108
     };
109 109
   });
110  
-  
  110
+
111 111
   return this;
112 112
 };
113 113
 
@@ -120,10 +120,10 @@ Logger.prototype.extend = function (target) {
120 120
 // Core logging method exposed to Winston. Metadata is optional.
121 121
 //
122 122
 Logger.prototype.log = function (level, msg) {
123  
-  var self = this, 
  123
+  var self = this,
124 124
       callback,
125 125
       meta;
126  
-  
  126
+
127 127
   if (arguments.length === 3) {
128 128
     if (typeof arguments[2] === 'function') {
129 129
       meta = {};
@@ -151,21 +151,21 @@ Logger.prototype.log = function (level, msg) {
151 151
       self.emit('error', err);
152 152
     };
153 153
   }
154  
-  
  154
+
155 155
   if (this.transports.length === 0) {
156 156
     return onError(new Error('Cannot log with no transports.'));
157 157
   }
158 158
   else if (typeof self.levels[level] === 'undefined') {
159 159
     return onError(new Error('Unknown log level: ' + level));
160 160
   }
161  
-  
  161
+
162 162
   this.rewriters.forEach(function(rewriter) {
163 163
     meta = rewriter(level, msg, meta);
164 164
   });
165  
-  
  165
+
166 166
   //
167 167
   // For consideration of terminal 'color" programs like colors.js,
168  
-  // which can add ANSI escape color codes to strings, we destyle the 
  168
+  // which can add ANSI escape color codes to strings, we destyle the
169 169
   // ANSI color escape codes when `this.stripColors` is set.
170 170
   //
171 171
   // see: http://en.wikipedia.org/wiki/ANSI_escape_code
@@ -174,7 +174,7 @@ Logger.prototype.log = function (level, msg) {
174 174
     var code = /\u001b\[\d+m/g;
175 175
     msg = ('' + msg).replace(code, '');
176 176
   }
177  
-  
  177
+
178 178
   for (var i = 0, l = this._names.length; i < l; i++) {
179 179
     var transport = this.transports[this._names[i]];
180 180
     if ((transport.level && self.levels[transport.level] <= self.levels[level])
@@ -184,14 +184,14 @@ Logger.prototype.log = function (level, msg) {
184 184
       });
185 185
     }
186 186
   }
187  
-  
  187
+
188 188
   //
189 189
   // Immediately respond to the callback
190 190
   //
191 191
   if (callback) {
192  
-    callback(null, level, msg, meta);    
  192
+    callback(null, level, msg, meta);
193 193
   }
194  
-  
  194
+
195 195
   return this;
196 196
 };
197 197
 
@@ -202,7 +202,7 @@ Logger.prototype.log = function (level, msg) {
202 202
 //
203 203
 Logger.prototype.close = function () {
204 204
   var self = this;
205  
-  
  205
+
206 206
   this._names.forEach(function (name) {
207 207
     var transport = self.transports[name];
208 208
     if (transport && transport.close) {
@@ -212,14 +212,14 @@ Logger.prototype.close = function () {
212 212
 };
213 213
 
214 214
 //
215  
-// ### function handleExceptions () 
  215
+// ### function handleExceptions ()
216 216
 // Handles `uncaughtException` events for the current process
217 217
 //
218 218
 Logger.prototype.handleExceptions = function () {
219 219
   var args = Array.prototype.slice.call(arguments),
220 220
       handlers = [],
221 221
       self = this;
222  
-      
  222
+
223 223
   args.forEach(function (a) {
224 224
     if (Array.isArray(a)) {
225 225
       handlers = handlers.concat(a);
@@ -228,13 +228,13 @@ Logger.prototype.handleExceptions = function () {
228 228
       handlers.push(a);
229 229
     }
230 230
   });
231  
-  
  231
+
232 232
   handlers.forEach(function (handler) {
233 233
     self.exceptionHandlers[handler.name] = handler;
234 234
   });
235  
-  
  235
+
236 236
   this._hnames = Object.keys(self.exceptionHandlers);
237  
-    
  237
+
238 238
   if (!this.catchExceptions) {
239 239
     this.catchExceptions = this._uncaughtException.bind(this);
240 240
     process.on('uncaughtException', this.catchExceptions);
@@ -242,20 +242,20 @@ Logger.prototype.handleExceptions = function () {
242 242
 };
243 243
 
244 244
 //
245  
-// ### function unhandleExceptions () 
  245
+// ### function unhandleExceptions ()
246 246
 // Removes any handlers to `uncaughtException` events
247 247
 // for the current process
248 248
 //
249 249
 Logger.prototype.unhandleExceptions = function () {
250 250
   var self = this;
251  
-  
  251
+
252 252
   if (this.catchExceptions) {
253 253
     Object.keys(this.exceptionHandlers).forEach(function (name) {
254 254
       if (handler.close) {
255 255
         handler.close();
256 256
       }
257 257
     });
258  
-    
  258
+
259 259
     this.exceptionHandlers = {};
260 260
     Object.keys(this.transports).forEach(function (name) {
261 261
       var transport = self.transports[name];
@@ -263,9 +263,9 @@ Logger.prototype.unhandleExceptions = function () {
263 263
         transport.handleExceptions = false;
264 264
       }
265 265
     })
266  
-    
  266
+
267 267
     process.removeListener('uncaughtException', this.catchExceptions);
268  
-    this.catchExceptions = false;    
  268
+    this.catchExceptions = false;
269 269
   }
270 270
 };
271 271
 
@@ -278,23 +278,23 @@ Logger.prototype.unhandleExceptions = function () {
278 278
 //
279 279
 Logger.prototype.add = function (transport, options, created) {
280 280
   var instance = created ? transport : (new (transport)(options));
281  
-  
  281
+
282 282
   if (!instance.name && !instance.log) {
283 283
     throw new Error('Unknown transport with no log() method');
284 284
   }
285 285
   else if (this.transports[instance.name]) {
286 286
     throw new Error('Transport already attached: ' + instance.name);
287 287
   }
288  
-  
  288
+
289 289
   this.transports[instance.name] = instance;
290 290
   this._names = Object.keys(this.transports);
291  
-  
  291
+
292 292
   //
293 293
   // Listen for the `error` event on the new Transport
294 294
   //
295 295
   instance._onError = this._onError.bind(this, instance)
296 296
   instance.on('error', instance._onError);
297  
-  
  297
+
298 298
   //
299 299
   // If this transport has `handleExceptions` set to `true`
300 300
   // and we are not already handling exceptions, do so.
@@ -328,25 +328,25 @@ Logger.prototype.clear = function () {
328 328
 };
329 329
 
330 330
 //
331  
-// ### function remove (transport) 
  331
+// ### function remove (transport)
332 332
 // #### @transport {Transport} Transport to remove.
333 333
 // Removes a transport of the specified type from this instance.
334 334
 //
335 335
 Logger.prototype.remove = function (transport) {
336 336
   var name = transport.name || transport.prototype.name;
337  
-    
  337
+
338 338
   if (!this.transports[name]) {
339 339
     throw new Error('Transport ' + name + ' not attached to this instance');
340 340
   }
341  
-  
  341
+
342 342
   var instance = this.transports[name];
343 343
   delete this.transports[name];
344 344
   this._names = Object.keys(this.transports);
345  
-  
  345
+
346 346
   if (instance.close) {
347 347
     instance.close();
348 348
   }
349  
-  
  349
+
350 350
   instance.removeListener('error', instance._onError);
351 351
   return this;
352 352
 };
@@ -361,7 +361,7 @@ var ProfileHandler = function (logger) {
361 361
     args     = Array.prototype.slice.call(arguments);
362 362
     callback = typeof args[args.length - 1] === 'function' ? args.pop() : null;
363 363
     meta     = typeof args[args.length - 1] === 'object' ? args.pop() : {};
364  
-   
  364
+
365 365
     meta.duration = (Date.now()) - this.start + 'ms';
366 366
 
367 367
     return this.logger.info(msg, meta, callback);
@@ -374,7 +374,7 @@ Logger.prototype.startTimer = function () {
374 374
 
375 375
 //
376 376
 // ### function profile (id, [msg, meta, callback])
377  
-// #### @id {string} Unique id of the profiler 
  377
+// #### @id {string} Unique id of the profiler
378 378
 // #### @msg {string} **Optional** Message to log
379 379
 // #### @meta {Object} **Optional** Additional metadata to attach
380 380
 // #### @callback {function} **Optional** Continuation to respond to when complete.
@@ -385,25 +385,25 @@ Logger.prototype.startTimer = function () {
385 385
 Logger.prototype.profile = function (id) {
386 386
   var now = Date.now(), then, args,
387 387
       msg, meta, callback;
388  
-  
  388
+
389 389
   if (this.profilers[id]) {
390 390
     then = this.profilers[id];
391 391
     delete this.profilers[id];
392  
-    
  392
+
393 393
     // Support variable arguments: msg, meta, callback
394 394
     args     = Array.prototype.slice.call(arguments);
395 395
     callback = typeof args[args.length - 1] === 'function' ? args.pop() : null;
396 396
     meta     = typeof args[args.length - 1] === 'object' ? args.pop() : {};
397  
-    msg      = args.length === 2 ? args[1] : id; 
398  
-    
  397
+    msg      = args.length === 2 ? args[1] : id;
  398
+
399 399
     // Set the duration property of the metadata
400  
-    meta.duration = now - then + 'ms'; 
  400
+    meta.duration = now - then + 'ms';
401 401
     return this.info(msg, meta, callback);
402 402
   }
403 403
   else {
404 404
     this.profilers[id] = now;
405 405
   }
406  
-  
  406
+
407 407
   return this;
408 408
 };
409 409
 
@@ -426,17 +426,17 @@ Logger.prototype.cli = function () {
426 426
   this.padLevels = true;
427 427
   this.setLevels(config.cli.levels);
428 428
   config.addColors(config.cli.colors);
429  
-  
  429
+
430 430
   if (this.transports.console) {
431 431
     this.transports.console.colorize = true;
432 432
     this.transports.console.timestamp = false;
433 433
   }
434  
-  
  434
+
435 435
   return this;
436 436
 };
437 437
 
438 438
 //
439  
-// ### @private function _uncaughtException (err) 
  439
+// ### @private function _uncaughtException (err)
440 440
 // #### @err {Error} Error to handle
441 441
 // Logs all relevant information around the `err` and
442 442
 // exits the current process.
@@ -448,18 +448,18 @@ Logger.prototype._uncaughtException = function (err) {
448 448
       handlers = this._getExceptionHandlers(),
449 449
       timeout,
450 450
       doExit;
451  
-  
  451
+
452 452
   //
453 453
   // Calculate if we should exit on this error
454 454
   //
455 455
   doExit = typeof this.exitOnError === 'function'
456 456
     ? this.exitOnError(err)
457 457
     : this.exitOnError;
458  
-  
  458
+
459 459
   function logAndWait(transport, next) {
460 460
     transport.logException('uncaughtException', info, next, err);
461 461
   }
462  
-  
  462
+
463 463
   function gracefulExit() {
464 464
     if (doExit && !responded) {
465 465
       //
@@ -471,11 +471,11 @@ Logger.prototype._uncaughtException = function (err) {
471 471
       process.exit(1);
472 472
     }
473 473
   }
474  
-  
  474
+
475 475
   if (!handlers || handlers.length === 0) {
476 476
     return gracefulExit();
477 477
   }
478  
-  
  478
+
479 479
   //
480 480
   // Log to all transports and allow the operation to take
481 481
   // only up to `3000ms`.
4  lib/winston/transports.js
@@ -18,11 +18,11 @@ var transports = exports;
18 18
 fs.readdirSync(path.join(__dirname, 'transports')).forEach(function (file) {
19 19
   var transport = file.replace('.js', ''),
20 20
       name  = common.capitalize(transport);
21  
-  
  21
+
22 22
   if (transport === 'transport') {
23 23
     return;
24 24
   }
25  
-  
  25
+
26 26
   transports.__defineGetter__(name, function () {
27 27
     return require('./transports/' + transport)[name];
28 28
   });
6  lib/winston/transports/console.js
@@ -21,12 +21,12 @@ var events = require('events'),
21 21
 var Console = exports.Console = function (options) {
22 22
   Transport.call(this, options);
23 23
   options = options || {};
24  
-  
  24
+
25 25
   this.name      = 'console';
26 26
   this.json      = options.json     || false;
27 27
   this.colorize  = options.colorize || false;
28 28
   this.timestamp = typeof options.timestamp !== 'undefined' ? options.timestamp : false;
29  
-  
  29
+
30 30
   if (this.json) {
31 31
     this.stringify = options.stringify || function (obj) {
32 32
       return JSON.stringify(obj, null, 2);
@@ -61,7 +61,7 @@ Console.prototype.log = function (level, msg, meta, callback) {
61 61
       output;
62 62
 
63 63
   output = common.log({
64  
-    colorize:  this.colorize, 
  64
+    colorize:  this.colorize,
65 65
     json:      this.json,
66 66
     level:     level,
67 67
     message:   msg,
42  lib/winston/transports/couchdb.js
@@ -10,7 +10,7 @@ var events = require('events'),
10 10
     http = require('http'),
11 11
     util = require('util'),
12 12
     common = require('../common'),
13  
-    Transport = require('./transport').Transport; 
  13
+    Transport = require('./transport').Transport;
14 14
 
15 15
 //
16 16
 // ### function Couchdb (options)
@@ -22,7 +22,7 @@ var events = require('events'),
22 22
 var Couchdb = exports.Couchdb = function (options) {
23 23
   Transport.call(this, options);
24 24
 
25  
-  this.name   = 'Couchdb'; 
  25
+  this.name   = 'Couchdb';
26 26
   this.db     = options.db;
27 27
   this.user   = options.user;
28 28
   this.pass   = options.pass;
@@ -32,14 +32,14 @@ var Couchdb = exports.Couchdb = function (options) {
32 32
   if (options.auth) {
33 33
     //
34 34
     // TODO: add http basic auth options for outgoing HTTP requests
35  
-    //     
  35
+    //
36 36
   }
37  
-  
  37
+
38 38
   if (options.ssl) {
39 39
     //
40 40
     //  TODO: add ssl support for outgoing HTTP requests
41 41
     //
42  
-  }  
  42
+  }
43 43
 };
44 44
 
45 45
 //
@@ -64,12 +64,12 @@ Couchdb.prototype.log = function (level, msg, meta, callback) {
64 64
   if (this.silent) {
65 65
     return callback(null, true);
66 66
   }
67  
-  
  67
+
68 68
   var self = this,
69 69
       message = common.clone(meta || {}),
70 70
       options,
71 71
       req;
72  
-      
  72
+
73 73
   message.level = level;
74 74
   message.message = msg;
75 75
 
@@ -81,18 +81,18 @@ Couchdb.prototype.log = function (level, msg, meta, callback) {
81 81
     method: "POST",
82 82
     headers: {"content-type": "application/json"}
83 83
   };
84  
-  
  84
+
85 85
   if (options.user && options.pass) {
86 86
     options.headers["Authorization"] = "Basic " + new Buffer(options.user + ":" + options.pass).toString('base64');
87 87
   }
88  
-  
  88
+
89 89
   // Perform HTTP logging request
90  
-  req = http.request(options, function (res) { 
  90
+  req = http.request(options, function (res) {
91 91
     //
92 92
     // No callback on request, fire and forget about the response
93 93
     //
94 94
     self.emit('logged', res);
95  
-  }); 
  95
+  });
96 96
 
97 97
   req.on('error', function (err) {
98 98
     //
@@ -101,22 +101,22 @@ Couchdb.prototype.log = function (level, msg, meta, callback) {
101 101
     //
102 102
     self.emit('error', err);
103 103
   });
104  
-  
  104
+
105 105
   //
106 106
   // Write logging event to the outgoing request body
107 107
   //
108  
-  req.write(JSON.stringify({ 
109  
-    method: 'log', 
110  
-    params: { 
  108
+  req.write(JSON.stringify({
  109
+    method: 'log',
  110
+    params: {
111 111
       timestamp: new Date(), // RFC3339/ISO8601 format instead of common.timestamp()
112  
-      msg: msg, 
113  
-      level: level, 
114  
-      meta: meta 
115  
-    } 
  112
+      msg: msg,
  113
+      level: level,
  114
+      meta: meta
  115
+    }
116 116
   }));
117  
-  
  117
+
118 118
   req.end();
119  
-  
  119
+
120 120
   // Always return true, regardless of any errors
121 121
   callback(null, true);
122 122
 };
72  lib/winston/transports/file.js
@@ -13,7 +13,7 @@ var events = require('events'),
13 13
     colors = require('colors'),
14 14
     common = require('../common'),
15 15
     Transport = require('./transport').Transport;
16  
-    
  16
+
17 17
 //
18 18
 // ### function File (options)
19 19
 // #### @options {Object} Options for this instance.
@@ -22,10 +22,10 @@ var events = require('events'),
22 22
 //
23 23
 var File = exports.File = function (options) {
24 24
   Transport.call(this, options);
25  
-  
  25
+
26 26
   //
27 27
   // Helper function which throws an `Error` in the event
28  
-  // that any of the rest of the arguments is present in `options`. 
  28
+  // that any of the rest of the arguments is present in `options`.
29 29
   //
30 30
   function throwIf (target /*, illegal... */) {
31 31
     Array.prototype.slice.call(arguments, 1).forEach(function (name) {
@@ -34,12 +34,12 @@ var File = exports.File = function (options) {
34 34
       }
35 35
     });
36 36
   }
37  
-  
  37
+
38 38
   if (options.filename || options.dirname) {
39 39
     throwIf('filename or dirname', 'stream');
40 40
     this._basename = this.filename = path.basename(options.filename) || 'winston.log';
41 41
     this.dirname   = options.dirname || path.dirname(options.filename);
42  
-    this.options   = options.options || { flags: 'a' };    
  42
+    this.options   = options.options || { flags: 'a' };
43 43
   }
44 44
   else if (options.stream) {
45 45
     throwIf('stream', 'filename', 'maxsize');
@@ -48,7 +48,7 @@ var File = exports.File = function (options) {
48 48
   else {
49 49
     throw new Error('Cannot log to file without filename or stream.');
50 50
   }
51  
-    
  51
+
52 52
   this.json      = options.json !== false;
53 53
   this.colorize  = options.colorize  || false;
54 54
   this.maxsize   = options.maxsize   || null;
@@ -97,9 +97,9 @@ File.prototype.log = function (level, msg, meta, callback) {
97 97
     colorize:  this.colorize,
98 98
     timestamp: this.timestamp
99 99
   }) + '\n';
100  
-  
  100
+
101 101
   this._size += output.length;
102  
-  
  102
+
103 103
   if (!this.filename) {
104 104
     //
105 105
     // If there is no `filename` on this instance then it was configured
@@ -117,7 +117,7 @@ File.prototype.log = function (level, msg, meta, callback) {
117 117
         //
118 118
         return self._buffer.push(output);
119 119
       }
120  
-      
  120
+
121 121
       self.stream.write(output);
122 122
       self._lazyDrain();
123 123
     });
@@ -144,13 +144,13 @@ File.prototype.open = function (callback) {
144 144
   else if (!this.stream || (this.maxsize && this._size >= this.maxsize)) {
145 145
     //
146 146
     // If we dont have a stream or have exceeded our size, then create
147  
-    // the next stream and respond with a value indicating that 
  147
+    // the next stream and respond with a value indicating that
148 148
     // the message should be buffered.
149 149
     //
150 150
     callback(true);
151 151
     return this._createStream();
152 152
   }
153  
-  
  153
+
154 154
   //
155 155
   // Otherwise we have a valid (and ready) stream.
156 156
   //
@@ -167,7 +167,7 @@ File.prototype.close = function () {
167 167
   if (this.stream) {
168 168
     this.stream.end();
169 169
     this.stream.destroySoon();
170  
-    
  170
+
171 171
     this.stream.once('drain', function () {
172 172
       self.emit('flush');
173 173
       self.emit('closed');
@@ -185,7 +185,7 @@ File.prototype.flush = function () {
185 185
 
186 186
   //
187 187
   // Iterate over the `_buffer` of enqueued messaged
188  
-  // and then write them to the newly created stream. 
  188
+  // and then write them to the newly created stream.
189 189
   //
190 190
   this._buffer.forEach(function (str) {
191 191
     process.nextTick(function () {
@@ -193,13 +193,13 @@ File.prototype.flush = function () {
193 193
       self._size += str.length;
194 194
     });
195 195
   });
196  
-  
  196
+
197 197
   //
198 198
   // Quickly truncate the `_buffer` once the write operations
199 199
   // have been started
200 200
   //
201 201
   self._buffer.length = 0;
202  
-  
  202
+
203 203
   //
204 204
   // When the stream has drained we have flushed
205 205
   // our buffer.
@@ -218,10 +218,10 @@ File.prototype.flush = function () {
218 218
 File.prototype._createStream = function () {
219 219
   var self = this;
220 220
   this.opening = true;
221  
-    
  221
+
222 222
   (function checkFile (target) {
223 223
     var fullname = path.join(self.dirname, target);
224  
-    
  224
+
225 225
     //
226 226
     // Creates the `WriteStream` and then flushes any
227 227
     // buffered messages.
@@ -231,14 +231,14 @@ File.prototype._createStream = function () {
231 231
         self.stream.end();
232 232
         self.stream.destroySoon();
233 233
       }
234  
-      
  234
+
235 235
       self._size = size;
236 236
       self.filename = target;
237 237
       self.stream = fs.createWriteStream(fullname, self.options);
238  
-      
  238
+
239 239
       //
240  
-      // When the current stream has finished flushing 
241  
-      // then we can be sure we have finished opening 
  240
+      // When the current stream has finished flushing
  241
+      // then we can be sure we have finished opening
242 242
       // and thus can emit the `open` event.
243 243
       //
244 244
       self.once('flush', function () {
@@ -260,21 +260,21 @@ File.prototype._createStream = function () {
260 260
         if (err.code !== 'ENOENT') {
261 261
           return self.emit('error', err);
262 262
         }
263  
-        
  263
+
264 264
         return createAndFlush(0);
265 265
       }
266  
-      
  266
+
267 267
       if (!stats || (self.maxsize && stats.size >= self.maxsize)) {
268 268
         //
269  
-        // If `stats.size` is greater than the `maxsize` for 
270  
-        // this instance then try again 
  269
+        // If `stats.size` is greater than the `maxsize` for
  270
+        // this instance then try again
271 271
         //
272 272
         return checkFile(self._getFile(true));
273 273
       }
274  
-      
  274
+
275 275
       createAndFlush(stats.size);
276 276
     });
277  
-  })(this._getFile());  
  277
+  })(this._getFile());
278 278
 };
279 279
 
280 280
 //
@@ -287,10 +287,10 @@ File.prototype._getFile = function (inc) {
287 287
       ext = path.extname(this._basename),
288 288
       basename = path.basename(this._basename, ext),
289 289
       remaining;
290  
-  
  290
+
291 291
   if (inc) {
292 292
     //
293  
-    // Increment the number of files created or 
  293
+    // Increment the number of files created or
294 294
     // checked by this instance.
295 295
     //
296 296
     // Check for maxFiles option and delete file
@@ -303,30 +303,30 @@ File.prototype._getFile = function (inc) {
303 303