Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 791 lines (618 sloc) 26.737 kB
bd33dcb @mmalecki [doc] Add Travis build status image
mmalecki authored
1 # winston [![Build Status](https://secure.travis-ci.org/flatiron/winston.png)](http://travis-ci.org/flatiron/winston)
917737a @indexzero [doc dist api] Initial commit ... no tests since I have no internet
indexzero authored
2
47a5bee @indexzero [dist doc] Version bump. Small updates to README.md for 0.1.0.
indexzero authored
3 A multi-transport async logging library for node.js. <span style="font-size:28px; font-weight:bold;">&quot;CHILL WINSTON! ... I put it in the logs.&quot;</span>
917737a @indexzero [doc dist api] Initial commit ... no tests since I have no internet
indexzero authored
4
b18dad9 @indexzero [doc] Updated README.md
indexzero authored
5 ## Motivation
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
6 Winston is designed to be a simple and universal logging library with support for multiple transports. A transport is essentially a storage device for your logs. Each instance of a winston logger can have multiple transports configured at different levels. For example, one may want error logs to be stored in a persistent remote location (like a database), but all logs output to the console or a local file.
b18dad9 @indexzero [doc] Updated README.md
indexzero authored
7
2e44fc8 @indexzero [doc] Finished first draft of documentation for 0.1.0
indexzero authored
8 There also seemed to be a lot of logging libraries out there that coupled their implementation of logging (i.e. how the logs are stored / indexed) to the API that they exposed to the programmer. This library aims to decouple those parts of the process to make it more flexible and extensible.
64b82cb @indexzero [doc api] Added to README.md. Started file transport.
indexzero authored
9
3ce7541 @indexzero [doc] More README.md changes
indexzero authored
10 ## Usage
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
11 There are two different ways to use winston: directly via the default logger, or by instantiating your own Logger. The former is merely intended to be a convenient shared logger to use throughout your application if you so choose.
3ce7541 @indexzero [doc] More README.md changes
indexzero authored
12
6c5d42d @indexzero [doc] Minor formatting fixes in README.md
indexzero authored
13 * [Logging](#logging)
d78fd52 @indexzero [doc] Continued refactor of README.md
indexzero authored
14 * [Using the Default Logger](#using-the-default-logger)
15 * [Instantiating your own Logger](#instantiating-your-own-logger)
16 * [Logging with Metadata](#logging-with-metadata)
c157e14 @indexzero [fix doc] Update link to Transports documentation to be in `master`
indexzero authored
17 * [Transports](https://github.com/flatiron/winston/blob/master/docs/transports.md)
d78fd52 @indexzero [doc] Continued refactor of README.md
indexzero authored
18 * [Profiling](#profiling)
19 * [Streaming Logs](#streaming-logs)
20 * [Querying Logs](#querying-logs)
6c5d42d @indexzero [doc] Minor formatting fixes in README.md
indexzero authored
21 * [Exceptions](#exceptions)
d78fd52 @indexzero [doc] Continued refactor of README.md
indexzero authored
22 * [Handling Uncaught Exceptions with winston](#handling-uncaught-exceptions-with-winston)
23 * [To Exit or Not to Exit](#to-exit-or-not-to-exit)
6c5d42d @indexzero [doc] Minor formatting fixes in README.md
indexzero authored
24 * [Logging Levels](#logging-levels)
d78fd52 @indexzero [doc] Continued refactor of README.md
indexzero authored
25 * [Using Logging Levels](#using-logging-levels)
26 * [Using Custom Logging Levels](#using-custom-logging-levels)
6c5d42d @indexzero [doc] Minor formatting fixes in README.md
indexzero authored
27 * [Further Reading](#further-reading)
d78fd52 @indexzero [doc] Continued refactor of README.md
indexzero authored
28 * [Events and Callbacks in Winston](#events-and-callbacks-in-winston)
29 * [Working with multiple Loggers in winston](#working-with-multiple-loggers-in-winston)
30 * [Using winston in a CLI tool](#using-winston-in-a-cli-tool)
31 * [Extending another object with Logging](#extending-another-object-with-logging)
32 * [Adding Custom Transports](#adding-custom-transports)
33
34 ## Logging
3ce7541 @indexzero [doc] More README.md changes
indexzero authored
35
36 ### Using the Default Logger
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogge…
indexzero authored
37 The default logger is accessible through the winston module directly. Any method that you could call on an instance of a logger is available on the default logger:
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
38
39 ``` js
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogge…
indexzero authored
40 var winston = require('winston');
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
41
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogge…
indexzero authored
42 winston.log('info', 'Hello distributed log files!');
43 winston.info('Hello again distributed logs');
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
44 ```
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogge…
indexzero authored
45
46 By default, only the Console transport is set on the default logger. You can add or remove transports via the add() and remove() methods:
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
47
48 ``` js
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogge…
indexzero authored
49 winston.add(winston.transports.File, { filename: 'somefile.log' });
50 winston.remove(winston.transports.Console);
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
51 ```
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogge…
indexzero authored
52
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
53 For more documenation about working with each individual transport supported by Winston see the "Working with Transports" section below.
3ce7541 @indexzero [doc] More README.md changes
indexzero authored
54
55 ### Instantiating your own Logger
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogge…
indexzero authored
56 If you would prefer to manage the object lifetime of loggers you are free to instantiate them yourself:
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
57
58 ``` js
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogge…
indexzero authored
59 var logger = new (winston.Logger)({
60 transports: [
61 new (winston.transports.Console)(),
62 new (winston.transports.File)({ filename: 'somefile.log' })
63 ]
64 });
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
65 ```
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogge…
indexzero authored
66
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
67 You can work with this logger in the same way that you work with the default logger:
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
68
69 ``` js
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogge…
indexzero authored
70 //
71 // Logging
72 //
73 logger.log('info', 'Hello distributed log files!');
74 logger.info('Hello again distributed logs');
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
75
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogge…
indexzero authored
76 //
77 // Adding / Removing Transports
2e44fc8 @indexzero [doc] Finished first draft of documentation for 0.1.0
indexzero authored
78 // (Yes It's chainable)
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogge…
indexzero authored
79 //
3f98022 @indexzero [doc] Updated README.md removing Riak transport
indexzero authored
80 logger.add(winston.transports.File)
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogge…
indexzero authored
81 .remove(winston.transports.Console);
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
82 ```
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogge…
indexzero authored
83
d78fd52 @indexzero [doc] Continued refactor of README.md
indexzero authored
84 ### Logging with Metadata
85 In addition to logging string messages, winston will also optionally log additional JSON metadata objects. Adding metadata is simple:
86
87 ``` js
88 winston.log('info', 'Test Log Message', { anything: 'This is metadata' });
89 ```
90
91 The way these objects is stored varies from transport to transport (to best support the storage mechanisms offered). Here's a quick summary of how each transports handles metadata:
92
93 1. __Console:__ Logged via util.inspect(meta)
94 2. __File:__ Logged via util.inspect(meta)
95
96 ## Profiling
97 In addition to logging messages and metadata, winston also has a simple profiling mechanism implemented for any logger:
98
99 ``` js
100 //
101 // Start profile of 'test'
102 // Remark: Consider using Date.now() with async operations
103 //
104 winston.profile('test');
105
106 setTimeout(function () {
107 //
108 // Stop profile of 'test'. Logging will now take place:
109 // "17 Jan 21:00:00 - info: test duration=1000ms"
110 //
111 winston.profile('test');
112 }, 1000);
113 ```
114
115 All profile messages are set to the 'info' by default and both message and metadata are optional There are no plans in the Roadmap to make this configurable, but I'm open to suggestions / issues.
116
117
118 ## Querying Logs
119 Winston supports querying of logs with Loggly-like options.
120 Specifically: `File`, `Couchdb`, `Redis`, `Loggly`, `Nssocket`, and `Http`.
121
122 ``` js
123 var options = {
124 from: new Date - 24 * 60 * 60 * 1000,
125 until: new Date
126 };
127
128 //
129 // Find items logged between today and yesterday.
130 //
131 winston.query(options, function (err, results) {
132 if (err) {
133 throw err;
134 }
135
136 console.log(results);
137 });
138 ```
139
140 ## Streaming Logs
141 Streaming allows you to stream your logs back from your chosen transport.
142
143 ``` js
144 //
145 // Start at the end.
146 //
147 winston.stream({ start: -1 }).on('log', function(log) {
148 console.log(log);
149 });
150 ```
151
152 ## Exceptions
153
8609730 @indexzero [doc] Updated README.md
indexzero authored
154 ### Handling Uncaught Exceptions with winston
155
156 With `winston`, it is possible to catch and log `uncaughtException` events from your process. There are two distinct ways of enabling this functionality either through the default winston logger or your own logger instance.
157
158 If you want to use this feature with the default logger simply call `.handleExceptions()` with a transport instance.
159
160 ``` js
161 //
162 // You can add a separate exception logger by passing it to `.handleExceptions`
163 //
164 winston.handleExceptions(new winston.transports.File({ filename: 'path/to/exceptions.log' }))
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
165
8609730 @indexzero [doc] Updated README.md
indexzero authored
166 //
167 // Alternatively you can set `.handleExceptions` to true when adding transports to winston
168 //
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
169 winston.add(winston.transports.File, {
170 filename: 'path/to/all-logs.log',
171 handleExceptions: true
8609730 @indexzero [doc] Updated README.md
indexzero authored
172 });
173 ```
174
6c5d42d @indexzero [doc] Minor formatting fixes in README.md
indexzero authored
175 ### To Exit or Not to Exit
45c5707 @dominictarr [docs] set whether to exitOnError
dominictarr authored
176
177 by default, winston will exit after logging an uncaughtException. if this is not the behavior you want,
178 set `exitOnError = false`
179
180 ``` js
5d1acae @indexzero [doc] Update README.md with new `exitOnError` functionality
indexzero authored
181 var logger = new (winston.Logger)({ exitOnError: false });
45c5707 @dominictarr [docs] set whether to exitOnError
dominictarr authored
182
5d1acae @indexzero [doc] Update README.md with new `exitOnError` functionality
indexzero authored
183 //
184 // or, like this:
185 //
186 logger.exitOnError = false;
45c5707 @dominictarr [docs] set whether to exitOnError
dominictarr authored
187 ```
188
8609730 @indexzero [doc] Updated README.md
indexzero authored
189 When working with custom logger instances, you can pass in separate transports to the `exceptionHandlers` property or set `.handleExceptions` on any transport.
190
4d050a5 @ubun2 Add example for showing exception handling
ubun2 authored
191 Example 1
192
8609730 @indexzero [doc] Updated README.md
indexzero authored
193 ``` js
194 var logger = new (winston.Logger)({
195 transports: [
196 new winston.transports.File({ filename: 'path/to/all-logs.log' })
197 ]
198 exceptionHandlers: [
199 new winston.transports.File({ filename: 'path/to/exceptions.log' })
200 ]
201 });
202 ```
203
4d050a5 @ubun2 Add example for showing exception handling
ubun2 authored
204 Example 2
205
206 ```
207 var logger = new winston.Logger({
208 transports: [
209 new winston.transports.Console({
210 handleExceptions: true,
211 json: true
212 })
213 ],
214 exitOnError: false
215 });
216 ```
217
5d1acae @indexzero [doc] Update README.md with new `exitOnError` functionality
indexzero authored
218 The `exitOnError` option can also be a function to prevent exit on only certain types of errors:
219
220 ``` js
221 function ignoreEpipe(err) {
222 return err.code !== 'EPIPE';
223 }
224
225 var logger = new (winston.Logger)({ exitOnError: ignoreEpipe });
226
227 //
228 // or, like this:
229 //
230 logger.exitOnError = ignoreEpipe;
231 ```
232
6c5d42d @indexzero [doc] Minor formatting fixes in README.md
indexzero authored
233 ## Logging Levels
234
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogge…
indexzero authored
235 ### Using Logging Levels
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
236 Setting the level for your logging message can be accomplished in one of two ways. You can pass a string representing the logging level to the log() method or use the level specified methods defined on every winston Logger.
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
237
238 ``` js
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogge…
indexzero authored
239 //
240 // Any logger instance
241 //
d4e9b44 @danilopopeye Fixed the broken ' in log
danilopopeye authored
242 logger.log('info', "127.0.0.1 - there's no place like home");
27ca3f8 @ubun2 Clarify how to log different levels
ubun2 authored
243 logger.log('warn', "127.0.0.1 - there's no place like home");
244 logger.log('error', "127.0.0.1 - there's no place like home");
d4e9b44 @danilopopeye Fixed the broken ' in log
danilopopeye authored
245 logger.info("127.0.0.1 - there's no place like home");
27ca3f8 @ubun2 Clarify how to log different levels
ubun2 authored
246 logger.warn("127.0.0.1 - there's no place like home");
247 logger.error("127.0.0.1 - there's no place like home");
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
248
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogge…
indexzero authored
249 //
250 // Default logger
251 //
d4e9b44 @danilopopeye Fixed the broken ' in log
danilopopeye authored
252 winston.log('info', "127.0.0.1 - there's no place like home");
253 winston.info("127.0.0.1 - there's no place like home");
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
254 ```
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogge…
indexzero authored
255
16dc3a9 @coderarity [doc] Add example of logging to a transport with the `level` option.
coderarity authored
256 Winston allows you to set a `level` on each transport that specifies the level of messages this transport should log. For example, you could log only errors to the console, with the full logs in a file:
257
258 ``` js
259 var logger = new (winston.Logger)({
260 transports: [
261 new (winston.transports.Console)({ level: 'error' }),
262 new (winston.transports.File)({ filename: 'somefile.log' })
263 ]
264 });
265 ```
266
ab0ec56 @indexzero [doc minor] Expose winston.addColors(). Update docs for custom levels
indexzero authored
267 As of 0.2.0, winston supports customizable logging levels, defaulting to [npm][0] style logging levels. Changing logging levels is easy:
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
268
269 ``` js
ab0ec56 @indexzero [doc minor] Expose winston.addColors(). Update docs for custom levels
indexzero authored
270 //
271 // Change levels on the default winston logger
272 //
273 winston.setLevels(winston.config.syslog.levels);
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
274
ab0ec56 @indexzero [doc minor] Expose winston.addColors(). Update docs for custom levels
indexzero authored
275 //
276 // Change levels on an instance of a logger
277 //
278 logger.setLevels(winston.config.syslog.levels);
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
279 ```
ab0ec56 @indexzero [doc minor] Expose winston.addColors(). Update docs for custom levels
indexzero authored
280
281 Calling `.setLevels` on a logger will remove all of the previous helper methods for the old levels and define helper methods for the new levels. Thus, you should be careful about the logging statements you use when changing levels. For example, if you ran this code after changing to the syslog levels:
282
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
283 ``` js
ab0ec56 @indexzero [doc minor] Expose winston.addColors(). Update docs for custom levels
indexzero authored
284 //
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
285 // Logger does not have 'silly' defined since that level is not in the syslog levels
ab0ec56 @indexzero [doc minor] Expose winston.addColors(). Update docs for custom levels
indexzero authored
286 //
287 logger.silly('some silly message');
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
288 ```
ab0ec56 @indexzero [doc minor] Expose winston.addColors(). Update docs for custom levels
indexzero authored
289
290 ### Using Custom Logging Levels
291 In addition to the predefined `npm` and `syslog` levels available in Winston, you can also choose to define your own:
292
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
293 ``` js
ab0ec56 @indexzero [doc minor] Expose winston.addColors(). Update docs for custom levels
indexzero authored
294 var myCustomLevels = {
295 levels: {
296 foo: 0,
297 bar: 1,
298 baz: 2,
299 foobar: 3
300 },
301 colors: {
302 foo: 'blue',
303 bar: 'green',
304 baz: 'yellow',
305 foobar: 'red'
306 }
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogge…
indexzero authored
307 };
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
308
309 var customLevelLogger = new (winston.Logger)({ levels: myCustomLevels.levels });
ab0ec56 @indexzero [doc minor] Expose winston.addColors(). Update docs for custom levels
indexzero authored
310 customLevelLogger.foobar('some foobar level-ed message');
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
311 ```
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogge…
indexzero authored
312
ab0ec56 @indexzero [doc minor] Expose winston.addColors(). Update docs for custom levels
indexzero authored
313 Although there is slight repetition in this data structure, it enables simple encapsulation if you not to have colors. If you do wish to have colors, in addition to passing the levels to the Logger itself, you must make winston aware of them:
314
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
315 ``` js
ab0ec56 @indexzero [doc minor] Expose winston.addColors(). Update docs for custom levels
indexzero authored
316 //
317 // Make winston aware of these colors
318 //
319 winston.addColors(myCustomLevels.colors);
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
320 ```
ab0ec56 @indexzero [doc minor] Expose winston.addColors(). Update docs for custom levels
indexzero authored
321
322 This enables transports with the 'colorize' option set to appropriately color the output of custom levels.
323
d78fd52 @indexzero [doc] Continued refactor of README.md
indexzero authored
324 ## Further Reading
325
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level arg…
indexzero authored
326 ### Events and Callbacks in Winston
327 Each instance of winston.Logger is also an instance of an [EventEmitter][1]. A log event will be raised each time a transport successfully logs a message:
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
328
329 ``` js
184c3bd @indexzero [doc] Fix typo in README.md. Fixes #57
indexzero authored
330 logger.on('logging', function (transport, level, msg, meta) {
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level arg…
indexzero authored
331 // [msg] and [meta] have now been logged at [level] to [transport]
332 });
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
333
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level arg…
indexzero authored
334 logger.info('CHILL WINSTON!', { seriously: true });
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
335 ```
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level arg…
indexzero authored
336
47a5bee @indexzero [dist doc] Version bump. Small updates to README.md for 0.1.0.
indexzero authored
337 It is also worth mentioning that the logger also emits an 'error' event which you should handle or suppress if you don't want unhandled exceptions:
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
338
339 ``` js
47a5bee @indexzero [dist doc] Version bump. Small updates to README.md for 0.1.0.
indexzero authored
340 //
341 // Handle errors
342 //
343 logger.on('error', function (err) { /* Do Something */ });
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
344
47a5bee @indexzero [dist doc] Version bump. Small updates to README.md for 0.1.0.
indexzero authored
345 //
346 // Or just suppress them.
347 //
348 logger.emitErrs = false;
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
349 ```
47a5bee @indexzero [dist doc] Version bump. Small updates to README.md for 0.1.0.
indexzero authored
350
2e44fc8 @indexzero [doc] Finished first draft of documentation for 0.1.0
indexzero authored
351 Every logging method described in the previous section also takes an optional callback which will be called only when all of the transports have logged the specified message.
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
352
353 ``` js
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level arg…
indexzero authored
354 logger.info('CHILL WINSTON!', { seriously: true }, function (err, level, msg, meta) {
355 // [msg] and [meta] have now been logged at [level] to **every** transport.
356 });
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
357 ```
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level arg…
indexzero authored
358
09926b3 @indexzero [doc] Updated README.md for `winston.loggers`
indexzero authored
359 ### Working with multiple Loggers in winston
360
361 Often in larger, more complex applications it is necessary to have multiple logger instances with different settings. Each logger is responsible for a different feature area (or category). This is exposed in `winston` in two ways: through `winston.loggers` and instances of `winston.Container`. In fact, `winston.loggers` is just a predefined instance of `winston.Container`:
362
363 ``` js
364 var winston = require('winston');
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
365
09926b3 @indexzero [doc] Updated README.md for `winston.loggers`
indexzero authored
366 //
367 // Configure the logger for `category1`
368 //
369 winston.loggers.add('category1', {
370 console: {
371 level: 'silly',
372 colorize: 'true'
373 },
374 file: {
375 filename: '/path/to/some/file'
376 }
377 });
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
378
09926b3 @indexzero [doc] Updated README.md for `winston.loggers`
indexzero authored
379 //
380 // Configure the logger for `category2`
381 //
382 winston.loggers.add('category2', {
383 couchdb: {
384 host: '127.0.0.1',
385 port: 5984
386 }
387 });
388 ```
389
390 Now that your loggers are setup you can require winston _in any file in your application_ and access these pre-configured loggers:
391
392 ``` js
393 var winston = require('winston');
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
394
09926b3 @indexzero [doc] Updated README.md for `winston.loggers`
indexzero authored
395 //
396 // Grab your preconfigured logger
397 //
398 var category1 = winston.loggers.get('category1');
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
399
09926b3 @indexzero [doc] Updated README.md for `winston.loggers`
indexzero authored
400 category1.info('logging from your IoC container-based logger');
401 ```
402
403 If you prefer to manage the `Container` yourself you can simply instantiate one:
404
405 ``` js
406 var winston = require('winston'),
407 container = new winston.Container();
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
408
09926b3 @indexzero [doc] Updated README.md for `winston.loggers`
indexzero authored
409 container.add('category1', {
410 console: {
411 level: 'silly',
412 colorize: 'true'
413 },
414 file: {
415 filename: '/path/to/some/file'
416 }
417 });
418 ```
419
fa65f54 @indexzero [doc] Updated README.md with docs about sharing transports in winston…
indexzero authored
420 ### Sharing transports between Loggers in winston
421
422 ``` js
423 var winston = require('winston');
424
425 //
426 // Setup transports to be shared across all loggers
427 // in three ways:
428 //
429 // 1. By setting it on the default Container
430 // 2. By passing `transports` into the constructor function of winston.Container
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
431 // 3. By passing `transports` into the `.get()` or `.add()` methods
fa65f54 @indexzero [doc] Updated README.md with docs about sharing transports in winston…
indexzero authored
432 //
433
434 //
435 // 1. By setting it on the default Container
436 //
437 winston.loggers.options.transports = [
438 // Setup your shared transports here
439 ];
440
441 //
442 // 2. By passing `transports` into the constructor function of winston.Container
443 //
444 var container = new winston.Container({
445 transports: [
446 // Setup your shared transports here
447 ]
448 });
449
450 //
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
451 // 3. By passing `transports` into the `.get()` or `.add()` methods
452 //
fa65f54 @indexzero [doc] Updated README.md with docs about sharing transports in winston…
indexzero authored
453 winston.loggers.add('some-category', {
454 transports: [
455 // Setup your shared transports here
456 ]
457 });
458
459 container.add('some-category', {
460 transports: [
461 // Setup your shared transports here
462 ]
463 });
464 ```
465
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
466 ### Using winston in a CLI tool
fed175b @indexzero [doc] Continued updating documentation
indexzero authored
467 A common use-case for logging is output to a CLI tool. Winston has a special helper method which will pretty print output from your CLI tool. Here's an example from the [require-analyzer][2] written by [Nodejitsu][3]:
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
468
469 ```
470 info: require-analyzer starting in /Users/Charlie/Nodejitsu/require-analyzer
471 info: Found existing dependencies
472 data: {
473 data: colors: '0.x.x',
474 data: eyes: '0.1.x',
475 data: findit: '0.0.x',
476 data: npm: '1.0.x',
477 data: optimist: '0.2.x',
478 data: semver: '1.0.x',
479 data: winston: '0.2.x'
480 data: }
481 info: Analyzing dependencies...
482 info: Done analyzing raw dependencies
483 info: Retrieved packages from npm
484 warn: No additional dependencies found
485 ```
486
487 Configuring output for this style is easy, just use the `.cli()` method on `winston` or an instance of `winston.Logger`:
488
489 ``` js
490 var winston = require('winston');
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
491
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
492 //
493 // Configure CLI output on the default logger
494 //
495 winston.cli();
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
496
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
497 //
498 // Configure CLI on an instance of winston.Logger
499 //
500 var logger = new winston.Logger({
501 transports: [
502 new (winston.transports.Console)()
503 ]
504 });
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
505
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
506 logger.cli();
507 ```
508
fd1b41c @indexzero [doc] Began refactoring README.md to be more human readable and index…
indexzero authored
509 ### Extending another object with Logging
27d0819 @indexzero [api test] Added Logger.extend() and winston.extend() methods
indexzero authored
510 Often in a given code base with lots of Loggers it is useful to add logging methods a different object so that these methods can be called with less syntax. Winston exposes this functionality via the 'extend' method:
511
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
512 ``` js
27d0819 @indexzero [api test] Added Logger.extend() and winston.extend() methods
indexzero authored
513 var myObject = {};
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
514
27d0819 @indexzero [api test] Added Logger.extend() and winston.extend() methods
indexzero authored
515 logger.extend(myObject);
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
516
27d0819 @indexzero [api test] Added Logger.extend() and winston.extend() methods
indexzero authored
517 //
518 // You can now call logger methods on 'myObject'
519 //
520 myObject.info('127.0.0.1 - there's no place like home');
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
521 ```
27d0819 @indexzero [api test] Added Logger.extend() and winston.extend() methods
indexzero authored
522
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogge…
indexzero authored
523 ## Working with Transports
2e44fc8 @indexzero [doc] Finished first draft of documentation for 0.1.0
indexzero authored
524 Right now there are four transports supported by winston core. If you have a transport you would like to add either open an issue or fork and submit a pull request. Commits are welcome, but I'll give you extra street cred if you __add tests too :D__
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogge…
indexzero authored
525
526 1. __Console:__ Output to the terminal
527 2. __Files:__ Append to a file
3f98022 @indexzero [doc] Updated README.md removing Riak transport
indexzero authored
528 3. __Loggly:__ Log to Logging-as-a-Service platform Loggly
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogge…
indexzero authored
529
530 ### Console Transport
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
531 ``` js
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level arg…
indexzero authored
532 winston.add(winston.transports.Console, options)
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
533 ```
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level arg…
indexzero authored
534
535 The Console transport takes two simple options:
2e44fc8 @indexzero [doc] Finished first draft of documentation for 0.1.0
indexzero authored
536
19a2899 @coderarity [doc] Correct default `Console` level
coderarity authored
537 * __level:__ Level of messages that this transport should log (default 'info').
f4609e6 @SeanBannister Fixing documentation silent defaults to false.
SeanBannister authored
538 * __silent:__ Boolean flag indicating whether to suppress output (default false).
0b1b18f @jfhbrook [doc] Document the "timestamp" option for the console transport
jfhbrook authored
539 * __colorize:__ Boolean flag indicating if we should colorize output (default false).
c50779a @iizukanao [doc] timestamp option accepts a function
iizukanao authored
540 * __timestamp:__ Boolean flag indicating if we should prepend output with timestamps (default false). If function is specified, its return value will be used instead of timestamps.
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level arg…
indexzero authored
541
542 *Metadata:* Logged via util.inspect(meta);
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogge…
indexzero authored
543
544 ### File Transport
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
545 ``` js
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level arg…
indexzero authored
546 winston.add(winston.transports.File, options)
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
547 ```
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level arg…
indexzero authored
548
2e44fc8 @indexzero [doc] Finished first draft of documentation for 0.1.0
indexzero authored
549 The File transport should really be the 'Stream' transport since it will accept any [WritableStream][14]. It is named such because it will also accept filenames via the 'filename' option:
550
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level arg…
indexzero authored
551 * __level:__ Level of messages that this transport should log.
552 * __silent:__ Boolean flag indicating whether to suppress output.
072b2d9 @indexzero [doc] Improve docs for 0.1.1 release
indexzero authored
553 * __colorize:__ Boolean flag indicating if we should colorize output.
ed8d7bb @ubun2 timestamp default should be true for file transport in README.md
ubun2 authored
554 * __timestamp:__ Boolean flag indicating if we should prepend output with timestamps (default true). If function is specified, its return value will be used instead of timestamps.
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level arg…
indexzero authored
555 * __filename:__ The filename of the logfile to write output to.
003dba5 [doc] added documentation for the maxsize and maxFiles options in Fil…
cronopio authored
556 * __maxsize:__ Max size in bytes of the logfile, if the size is exceeded then a new file is created.
557 * __maxFiles:__ Limit the number of files created when the size of the logfile is exceeded.
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level arg…
indexzero authored
558 * __stream:__ The WriteableStream to write output to.
d60051d @iizukanao Adding doc about `timestamp` and `json` options for File Transport
iizukanao authored
559 * __json:__ If true, messages will be logged as JSON (default true).
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level arg…
indexzero authored
560
561 *Metadata:* Logged via util.inspect(meta);
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogge…
indexzero authored
562
563 ### Loggly Transport
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
564 ``` js
4db4399 @ubun2 Clarify that Loggly is a separate module like Riak and the others.
ubun2 authored
565 var Loggly = require('winston-loggly').Loggly
566 winston.add(Loggly, options);
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
567 ```
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level arg…
indexzero authored
568
569 The Loggly transport is based on [Nodejitsu's][5] [node-loggly][6] implementation of the [Loggly][7] API. If you haven't heard of Loggly before, you should probably read their [value proposition][8]. The Loggly transport takes the following options. Either 'inputToken' or 'inputName' is required:
2e44fc8 @indexzero [doc] Finished first draft of documentation for 0.1.0
indexzero authored
570
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level arg…
indexzero authored
571 * __level:__ Level of messages that this transport should log.
572 * __subdomain:__ The subdomain of your Loggly account. *[required]*
573 * __auth__: The authentication information for your Loggly account. *[required with inputName]*
574 * __inputName:__ The name of the input this instance should log to.
575 * __inputToken:__ The input token of the input this instance should log to.
f6d4d64 @indexzero [api doc] Update Loggly transport to support JSON logging. Update REA…
indexzero authored
576 * __json:__ If true, messages will be sent to Loggly as JSON.
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level arg…
indexzero authored
577
578 *Metadata:* Logged in suggested [Loggly format][2]
64b82cb @indexzero [doc api] Added to README.md. Started file transport.
indexzero authored
579
1e38fd0 @indexzero [refactor] Refactor Riak transport into winston-riak
indexzero authored
580 ### Riak Transport
581 As of `0.3.0` the Riak transport has been broken out into a new module: [winston-riak][17]. Using it is just as easy:
582
583 ``` js
584 var Riak = require('winston-riak').Riak;
585 winston.add(Riak, options);
586 ```
587
588 In addition to the options accepted by the [riak-js][3] [client][4], the Riak transport also accepts the following options. It is worth noting that the riak-js debug option is set to *false* by default:
589
590 * __level:__ Level of messages that this transport should log.
591 * __bucket:__ The name of the Riak bucket you wish your logs to be in or a function to generate bucket names dynamically.
592
593 ``` js
594 // Use a single bucket for all your logs
595 var singleBucketTransport = new (Riak)({ bucket: 'some-logs-go-here' });
596
597 // Generate a dynamic bucket based on the date and level
598 var dynamicBucketTransport = new (Riak)({
599 bucket: function (level, msg, meta, now) {
600 var d = new Date(now);
601 return level + [d.getDate(), d.getMonth(), d.getFullYear()].join('-');
602 }
603 });
604 ```
605
606 *Metadata:* Logged as JSON literal in Riak
607
24f12fe @sktaylor Updated documentation to reflect new MongoDB transport, also dropped …
sktaylor authored
608 ### MongoDB Transport
d77f61b @indexzero [refactor] Refactor MongoDB trasnport into winston-mongodb
indexzero authored
609 As of `0.3.0` the MongoDB transport has been broken out into a new module: [winston-mongodb][16]. Using it is just as easy:
610
24f12fe @sktaylor Updated documentation to reflect new MongoDB transport, also dropped …
sktaylor authored
611 ``` js
3afac7c @indexzero [doc] Update README.md for `winston-mongodb`. Fixes #35
indexzero authored
612 var MongoDB = require('winston-mongodb').MongoDB;
d77f61b @indexzero [refactor] Refactor MongoDB trasnport into winston-mongodb
indexzero authored
613 winston.add(MongoDB, options);
24f12fe @sktaylor Updated documentation to reflect new MongoDB transport, also dropped …
sktaylor authored
614 ```
615
616 The MongoDB transport takes the following options. 'db' is required:
617
618 * __level:__ Level of messages that this transport should log.
619 * __silent:__ Boolean flag indicating whether to suppress output.
620 * __db:__ The name of the database you want to log to. *[required]*
621 * __collection__: The name of the collection you want to store log messages in, defaults to 'log'.
0de8d0a @sktaylor Added safe flag to options, for eventual consistency of log messages,…
sktaylor authored
622 * __safe:__ Boolean indicating if you want eventual consistency on your log messages, if set to true it requires an extra round trip to the server to ensure the write was committed, defaults to true.
24f12fe @sktaylor Updated documentation to reflect new MongoDB transport, also dropped …
sktaylor authored
623 * __host:__ The host running MongoDB, defaults to localhost.
624 * __port:__ The port on the host that MongoDB is running on, defaults to MongoDB's default port.
625
626 *Metadata:* Logged as a native JSON object.
627
b45d546 @chilts [doc] Add docs for the winston-simpledb transport
chilts authored
628 ### SimpleDB Transport
629
630 The [winston-simpledb][18] transport is just as easy:
631
632 ``` js
633 var SimpleDB = require('winston-simpledb').SimpleDB;
0d6787f Fixed a copy-paste error in README.md.
Jaakko Nissi authored
634 winston.add(SimpleDB, options);
b45d546 @chilts [doc] Add docs for the winston-simpledb transport
chilts authored
635 ```
636
637 The SimpleDB transport takes the following options. All items marked with an asterisk are required:
638
639 * __awsAccessKey__:* your AWS Access Key
640 * __secretAccessKey__:* your AWS Secret Access Key
641 * __awsAccountId__:* your AWS Account Id
642 * __domainName__:* a string or function that returns the domain name to log to
643 * __region__:* the region your domain resides in
644 * __itemName__: a string ('uuid', 'epoch', 'timestamp') or function that returns the item name to log
645
646 *Metadata:* Logged as a native JSON object to the 'meta' attribute of the item.
647
d75e849 @wavded Docs for winston-mail transport.
wavded authored
648 ### Mail Transport
649
650 The [winston-mail][19] is an email transport:
651
652 ``` js
fe43db9 @wavded Error in winston-mail documentation, had a reference to winston-simpledb
wavded authored
653 var Mail = require('winston-mail').Mail;
d75e849 @wavded Docs for winston-mail transport.
wavded authored
654 winston.add(Mail, options);
655 ```
656
6df0bed @wavded updated; mail transport readme
wavded authored
657 The Mail transport uses [emailjs](https://github.com/eleith/emailjs) behind the scenes. Options are the following:
d75e849 @wavded Docs for winston-mail transport.
wavded authored
658
659 * __to:__ The address(es) you want to send to. *[required]*
660 * __from:__ The address you want to send from. (default: `winston@[server-host-name]`)
6df0bed @wavded updated; mail transport readme
wavded authored
661 * __host:__ SMTP server hostname (default: localhost)
d75e849 @wavded Docs for winston-mail transport.
wavded authored
662 * __port:__ SMTP port (default: 587 or 25)
663 * __username__ User for server auth
664 * __password__ Password for server auth
6df0bed @wavded updated; mail transport readme
wavded authored
665 * __ssl:__ Use SSL (boolean or object { key, ca, cert })
666 * __tls:__ Boolean (if true, use starttls)
d75e849 @wavded Docs for winston-mail transport.
wavded authored
667 * __level:__ Level of messages that this transport should log.
668 * __silent:__ Boolean flag indicating whether to suppress output.
669
670 *Metadata:* Stringified as JSON in email.
671
1f1b0a9 @jesseditson adding README entry for winston-sns transport
jesseditson authored
672 ### Amazon SNS (Simple Notification System) Transport
673
674 The [winston-sns][21] transport uses amazon SNS to send emails, texts, or a bunch of other notifications.
675
676 ``` js
677 require('winston-sns').SNS;
678 winston.add(winston.transports.SNS, options);
679 ```
680
681 Options:
682
683 * __aws_key:__ Your Amazon Web Services Key. *[required]*
684 * __aws_secret:__ Your Amazon Web Services Secret. *[required]*
685 * __subscriber:__ Subscriber number - found in your SNS AWS Console, after clicking on a topic. Same as AWS Account ID. *[required]*
686 * __topic_arn:__ Also found in SNS AWS Console - listed under a topic as Topic ARN. *[required]*
687 * __region:__ AWS Region to use. Can be one of: `us-east-1`,`us-west-1`,`eu-west-1`,`ap-southeast-1`,`ap-northeast-1`,`us-gov-west-1`,`sa-east-1`. (default: `us-east-1`)
688 * __subject:__ Subject for notifications. (default: "Winston Error Report")
689 * __message:__ Message of notifications. Uses placeholders for level (%l), error message (%e), and metadata (%m). (default: "Level '%l' Error:\n%e\n\nMetadata:\n%m")
690 * __level:__ lowest level this transport will log. (default: `info`)
691
671f260 @smithclay added note to readme about the graylog2 transport
smithclay authored
692 ### Graylog2 Transport
693
694 [winston-graylog2][22] is a Graylog2 transport:
695
696 ``` js
697 var Graylog2 = require('winston-graylog2').Graylog2;
698 winston.add(Graylog2, options);
699 ```
700
701 The Graylog2 transport connects to a Graylog2 server over UDP using the following options:
702
703 * __level:__ Level of messages this transport should log. (default: info)
704 * __silent:__ Boolean flag indicating whether to suppress output. (default: false)
705
706 * __graylogHost:__ IP address or hostname of the graylog2 server. (default: localhost)
707 * __graylogPort:__ Port to send messages to on the graylog2 server. (default: 12201)
708 * __graylogHostname:__ The hostname associated with graylog2 messages. (default: require('os').hostname())
709 * __graylogFacility:__ The graylog2 facility to send log messages.. (default: nodejs)
710
711 *Metadata:* Stringified as JSON in the full message GELF field.
712
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogge…
indexzero authored
713 ### Adding Custom Transports
2e44fc8 @indexzero [doc] Finished first draft of documentation for 0.1.0
indexzero authored
714 Adding a custom transport (say for one of the datastore on the Roadmap) is actually pretty easy. All you need to do is accept a couple of options, set a name, implement a log() method, and add it to the set of transports exposed by winston.
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
715
716 ``` js
8162c4a @indexzero [api doc] Added base Transport object which all other transports deri…
indexzero authored
717 var util = require('util'),
718 winston = require('winston');
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
719
2e44fc8 @indexzero [doc] Finished first draft of documentation for 0.1.0
indexzero authored
720 var CustomLogger = winston.transports.CustomerLogger = function (options) {
721 //
722 // Name this logger
723 //
724 this.name = 'customLogger';
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
725
2e44fc8 @indexzero [doc] Finished first draft of documentation for 0.1.0
indexzero authored
726 //
727 // Set the level from your options
728 //
729 this.level = options.level || 'info';
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
730
2e44fc8 @indexzero [doc] Finished first draft of documentation for 0.1.0
indexzero authored
731 //
732 // Configure your storage backing as you see fit
733 //
734 };
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
735
8162c4a @indexzero [api doc] Added base Transport object which all other transports deri…
indexzero authored
736 //
737 // Inherit from `winston.Transport` so you can take advantage
738 // of the base functionality and `.handleExceptions()`.
739 //
740 util.inherits(CustomLogger, winston.Transport);
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
741
2e44fc8 @indexzero [doc] Finished first draft of documentation for 0.1.0
indexzero authored
742 CustomLogger.prototype.log = function (level, msg, meta, callback) {
743 //
744 // Store this message and metadata, maybe use some custom logic
745 // then callback indicating success.
746 //
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
747 callback(null, true);
2e44fc8 @indexzero [doc] Finished first draft of documentation for 0.1.0
indexzero authored
748 };
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
749 ```
b18dad9 @indexzero [doc] Updated README.md
indexzero authored
750
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogge…
indexzero authored
751 ### Inspirations
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level arg…
indexzero authored
752 1. [npm][0]
fed175b @indexzero [doc] Continued updating documentation
indexzero authored
753 2. [log.js][4]
754 3. [socket.io][5]
755 4. [node-rlog][6]
756 5. [BigBrother][7]
757 6. [Loggly][8]
64b82cb @indexzero [doc api] Added to README.md. Started file transport.
indexzero authored
758
fd1b41c @indexzero [doc] Began refactoring README.md to be more human readable and index…
indexzero authored
759 ## Installation
b18dad9 @indexzero [doc] Updated README.md
indexzero authored
760
fd1b41c @indexzero [doc] Began refactoring README.md to be more human readable and index…
indexzero authored
761 ### Installing npm (node package manager)
762 ```
763 curl http://npmjs.org/install.sh | sh
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
764 ```
20698a9 @indexzero [api test doc] Small updates to docs. Make instances of transports on…
indexzero authored
765
fd1b41c @indexzero [doc] Began refactoring README.md to be more human readable and index…
indexzero authored
766 ### Installing winston
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
767 ```
fd1b41c @indexzero [doc] Began refactoring README.md to be more human readable and index…
indexzero authored
768 [sudo] npm install winston
769 ```
b18dad9 @indexzero [doc] Updated README.md
indexzero authored
770
20698a9 @indexzero [api test doc] Small updates to docs. Make instances of transports on…
indexzero authored
771 ## Run Tests
fed175b @indexzero [doc] Continued updating documentation
indexzero authored
772 All of the winston tests are written in [vows][9], and designed to be run with npm.
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
773
fed175b @indexzero [doc] Continued updating documentation
indexzero authored
774 ``` bash
775 $ npm test
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
776 ```
20698a9 @indexzero [api test doc] Small updates to docs. Make instances of transports on…
indexzero authored
777
778 #### Author: [Charlie Robbins](http://twitter.com/indexzero)
0d09b41 @indexzero [doc] Added Marak as a contributor
indexzero authored
779 #### Contributors: [Matthew Bergman](http://github.com/fotoverite), [Marak Squires](http://github.com/marak)
b18dad9 @indexzero [doc] Updated README.md
indexzero authored
780
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level arg…
indexzero authored
781 [0]: https://github.com/isaacs/npm/blob/master/lib/utils/log.js
782 [1]: http://nodejs.org/docs/v0.3.5/api/events.html#events.EventEmitter
fed175b @indexzero [doc] Continued updating documentation
indexzero authored
783 [2]: http://github.com/nodejitsu/require-analyzer
784 [3]: http://nodejitsu.com
785 [4]: https://github.com/visionmedia/log.js
786 [5]: http://socket.io
787 [6]: https://github.com/jbrisbin/node-rlog
788 [7]: https://github.com/feisty/BigBrother
789 [8]: http://loggly.com
790 [9]: http://vowsjs.org
Something went wrong with that request. Please try again.