+
+Field |
+Required? |
+Default |
+Description |
+
+
+type |
+Yes |
+- |
+"rotating-file" |
+
+
+path |
+Yes |
+- |
+A file path to which to log. Rotated files will be "$path.0",
+"$path.1", ... |
+
+
+period |
+No |
+1d |
+The period at which to rotate. This is a string of the format
+"$number$scope" where "$scope" is one of "h" (hours), "d" (days), "w" (weeks),
+"m" (months), "y" (years). Or one of the following names can be used
+"hourly" (means 1h), "daily" (1d), "weekly" (1w), "monthly" (1m),
+"yearly" (1y). Rotation is done at the "start" |
+
+
+count |
+No |
+10 |
+The number of rotated files to keep. |
+
+
+level |
+No |
+info |
+The level at which logging to this stream is enabled. If not
+specified it defaults to "info". If specified this can be one of the
+level strings ("trace", "debug", ...) or constants (`bunyan.TRACE`,
+`bunyan.DEBUG`, ...). |
+
+
+name |
+No |
+- |
+A name for this stream. This may be useful for usage of `log.level(NAME,
+LEVEL)`. See the [Levels section](#levels) for details. A stream "name" isn't
+used for anything else. |
+
+
+
+
+
+## stream type: `raw`
- `raw`: Similar to a "stream" writeable stream, except that the write method
is given raw log record *Object*s instead of a JSON-stringified string.
@@ -475,7 +721,8 @@ Supported stream types are:
pushing to an external service, a RingBuffer (see below), etc.
-## RingBuffer Stream
+
+## `raw` + RingBuffer Stream
Bunyan comes with a special stream called a RingBuffer which keeps the last N
records in memory and does *not* write the data anywhere else. One common
@@ -488,7 +735,7 @@ To use a RingBuffer:
/* Create a ring buffer that stores the last 100 records. */
var bunyan = require('bunyan');
var ringbuffer = new bunyan.RingBuffer({ limit: 100 });
- var log = new bunyan({
+ var log = bunyan.createLogger({
name: 'foo',
streams: [
{
@@ -517,6 +764,16 @@ This example emits:
v: 0 } ]
+## third-party streams
+
+- syslog:
+ [mcavage/node-bunyan-syslog](https://github.com/mcavage/node-bunyan-syslog)
+ provides support for directing bunyan logging to a syslog server.
+
+- TODO: eventually https://github.com/trentm/node-bunyan-winston
+
+
+
# DTrace support
On systems that support DTrace (e.g., MacOS, FreeBSD, illumos derivatives
@@ -535,6 +792,7 @@ written to the log. Note that when a probe is enabled, it will
fire whenever the corresponding function is called, even if the level of
the log message is less than that of any stream.
+
## DTrace examples
Trace all log messages coming from any Bunyan module on the system.
@@ -634,10 +892,13 @@ change, and bug fixes, respectively.
# License
-MIT.
+MIT. See "LICENSE.txt".
+# See Also
-# Future
-
-See "TODO.md".
+- Bunyan syslog support: