doc tweaks, GH-markdown workarounds

This commit is contained in:
Trent Mick 2012-02-05 19:50:05 -08:00
parent d7e499b639
commit 9786827579

View file

@ -32,7 +32,7 @@ format version) are added for you.
$ node hi.js $ node hi.js
{"service":"myapp","hostname":"banana.local","level":2,"msg":"hi","time":"2012-01-31T00:07:44.216Z","v":0} {"service":"myapp","hostname":"banana.local","level":2,"msg":"hi","time":"2012-01-31T00:07:44.216Z","v":0}
A **`bunyan` tool is provided for pretty-printing** bunyan logs and, eventually, A `bunyan` tool is provided **for pretty-printing bunyan logs** and, eventually,
for filtering (e.g. `| bunyan -c 'level>3'`). This shows the default output for filtering (e.g. `| bunyan -c 'level>3'`). This shows the default output
(which is fluid right now) and indented-JSON output. More output formats will (which is fluid right now) and indented-JSON output. More output formats will
be added, including support for custom formats. be added, including support for custom formats.
@ -73,7 +73,7 @@ streams at different levels**.
] ]
}); });
A **`log.child(...)`** is provided to specialize a logger for a sub-component. A `log.child(...)` is provided to **specialize a logger for a sub-component**.
The following will have log records from "Wuzzle" instances use exactly the The following will have log records from "Wuzzle" instances use exactly the
same config as its parent, plus include the "component" field. same config as its parent, plus include the "component" field.
@ -93,20 +93,23 @@ same config as its parent, plus include the "component" field.
wuzzle.woos(); wuzzle.woos();
log.info("done with the wuzzle") log.info("done with the wuzzle")
* * *
An example and a hack: The [node-restify](https://github.com/mcavage/node-restify) An example and a hack: The [node-restify](https://github.com/mcavage/node-restify)
framework integrates bunyan. One feature is that each restify request handler framework integrates bunyan. One feature is that each restify request handler
includes a `req.log` logger that is a: includes a `req.log` logger that is:
log.child({req_id: <unique request id>}, true) log.child({req_id: <unique request id>}, true)
Apps using restify can then use `req.log` and have all such log records Apps using restify can then use `req.log` and have all such log records
include the unique request id (as "req_id"). Handy. *What is that `true`?* It include the unique request id (as "req_id"). Handy.
is a small bunyan hack by which you can assert that you're just adding
simple fields to the child logger. This makes `log.child` 10x faster and,
hence, never a worry for slowing down HTTP request handling. See the
changelog for node-bunyan 0.3.0 for details.
*What is that `true`?* It is a small bunyan hack by which you can assert that
you're just adding simple fields to the child logger. This makes `log.child`
10x faster and, hence, never a worry for slowing down HTTP request handling.
See the changelog for node-bunyan 0.3.0 for details.
* * *
Back to the `log.{trace|debug|...|fatal}(...)` API: Back to the `log.{trace|debug|...|fatal}(...)` API:
@ -158,23 +161,6 @@ in your log record will be replaced with a short error message.*
# Future
See "TODO.md", but basically:
- More std serializers. See TODO.md.
- Spec'ing and enforcing the fields (from dap's section in eng guide).
- Syslog support. Ring-buffer support for storing last N debug messages
(or whatever) in memory to support debugability without too much log load.
- More `bunyan` output formats and filtering features.
- Think about a bunyan dashboard that supports organizing and viewing logs
from multiple hosts and services.
# Levels # Levels
@ -328,3 +314,21 @@ are:
MIT. MIT.
# Future
See "TODO.md", but basically:
- Ring-buffer support for storing last N debug messages
(or whatever) in memory to support debugability without too much log load.
- More `bunyan` output formats and filtering features.
- Think about a bunyan dashboard that supports organizing and viewing logs
from multiple hosts and services.
- Syslog support.
- Some speed comparisons with others to get a feel for Bunyan's speed.