Comparing version 1.2.0 to 1.2.1
@@ -28,4 +28,4 @@ 'use strict'; | ||
// @todo Add browser support. | ||
process.stderr.write(body); | ||
process.stderr.write(body + '\n'); | ||
}); | ||
//# sourceMappingURL=log.js.map |
@@ -71,3 +71,3 @@ { | ||
}, | ||
"version": "1.2.0" | ||
"version": "1.2.1" | ||
} |
@@ -26,2 +26,3 @@ # Roarr | ||
* [Conventions](#conventions) | ||
* [Context property names](#context-property-names) | ||
* [Using Roarr in an application](#using-roarr-in-an-application) | ||
@@ -60,6 +61,6 @@ | ||
``` | ||
{"context":{},"message":"foo","sequence":0,"time":1506776210001,"version":"1.0.0"} | ||
{"context":{},"message":"bar baz","sequence":1,"time":1506776210002,"version":"1.0.0"} | ||
{"context":{"level":"debug"},"message":"qux","sequence":2,"time":1506776210003,"version":"1.0.0"} | ||
{"context":{"level":"debug","quuz":"corge"},"sequence":3,"message":"quux","time":1506776210004,"version":"1.0.0"} | ||
{"context":{},"message":"foo","sequence":0,"time":1506776210000,"version":"1.0.0"} | ||
{"context":{},"message":"bar baz","sequence":1,"time":1506776210000,"version":"1.0.0"} | ||
{"context":{"level":"debug"},"message":"qux","sequence":2,"time":1506776210000,"version":"1.0.0"} | ||
{"context":{"level":"debug","quuz":"corge"},"sequence":3,"message":"quux","time":1506776210000,"version":"1.0.0"} | ||
@@ -92,5 +93,5 @@ ``` | ||
``` | ||
{"context":{},"message":"foo","sequence":0,"time":1506776210001,"version":"1.0.0"} | ||
{"context":{"taskId":1},"message":"bar","sequence":1,"time":1506776210002,"version":"1.0.0"} | ||
{"context":{},"message":"baz","sequence":2,"time":1506776210003,"version":"1.0.0"} | ||
{"context":{},"message":"foo","sequence":0,"time":1506776210000,"version":"1.0.0"} | ||
{"context":{"taskId":1},"message":"bar","sequence":1,"time":1506776210000,"version":"1.0.0"} | ||
{"context":{},"message":"baz","sequence":2,"time":1506776210000,"version":"1.0.0"} | ||
@@ -133,5 +134,5 @@ ``` | ||
``` | ||
{"context":{"taskId":1},"message":"starting task ID 1","sequence":0,"time":1506776210001,"version":"1.0.0"} | ||
{"context":{"taskId":1},"message":"foo","sequence":1,"time":1506776210002,"version":"1.0.0"} | ||
{"context":{"taskId":1},"message":"successfully completed task ID 1","sequence":2,"time":1506776210003,"version":"1.0.0"} | ||
{"context":{"taskId":1},"message":"starting task ID 1","sequence":0,"time":1506776210000,"version":"1.0.0"} | ||
{"context":{"taskId":1},"message":"foo","sequence":1,"time":1506776210000,"version":"1.0.0"} | ||
{"context":{"taskId":1},"message":"successfully completed task ID 1","sequence":2,"time":1506776210000,"version":"1.0.0"} | ||
[...] | ||
@@ -220,3 +221,8 @@ | ||
log.trace('foo'); | ||
log.debug('foo'); | ||
log.info('foo'); | ||
log.warn('foo'); | ||
log.error('foo'); | ||
log.fatal('foo'); | ||
@@ -228,3 +234,8 @@ ``` | ||
``` | ||
{"context":{"logLevel":"debug"},"message":"foo","sequence":0,"time":1506776210001,"version":"1.0.0"} | ||
{"context":{"logLevel":"trace"},"message":"foo","sequence":0,"time":1506776210000,"version":"1.0.0"} | ||
{"context":{"logLevel":"debug"},"message":"foo","sequence":1,"time":1506776210000,"version":"1.0.0"} | ||
{"context":{"logLevel":"info"},"message":"foo","sequence":2,"time":1506776210000,"version":"1.0.0"} | ||
{"context":{"logLevel":"warn"},"message":"foo","sequence":3,"time":1506776210000,"version":"1.0.0"} | ||
{"context":{"logLevel":"error"},"message":"foo","sequence":4,"time":1506776210000,"version":"1.0.0"} | ||
{"context":{"logLevel":"fatal"},"message":"foo","sequence":5,"time":1506776210000,"version":"1.0.0"} | ||
@@ -257,2 +268,13 @@ ``` | ||
### Context property names | ||
Roarr does not have reserved context property names. However, I encourage use of the following conventions: | ||
|Context property name|Use case| | ||
|---|---| | ||
|`application`|Name of the application (do not use in code intended for distribution; see `package` property instead).| | ||
|`package`|Name of the package.| | ||
|`logLevel`|Human-readable name of the log-level, e.g. "error". See [API](#api) for build-in loggers with a pre-set log-level.| | ||
|`namespace`|Namespace within a package, e.g. function name. Treat the same way that you would construct namespaces when using the [`debug`](https://github.com/visionmedia/debug) package.| | ||
### Using Roarr in an application | ||
@@ -276,2 +298,5 @@ | ||
// those of the "my-application" dependencies. | ||
// | ||
// Note: If you are adding logger to a package intended to be consumed by other | ||
// packages, you must not set `global.ROARR.prepend`. Instead, use `roarr#child`. | ||
global.ROARR.prepend = { | ||
@@ -278,0 +303,0 @@ ...global.ROARR.prepend, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
27430
309