Skip to content

Commit

Permalink
2.0.0-beta.13
Browse files Browse the repository at this point in the history
### The lucky number beta
+ Added file that was missing from commit (but not from publish)
+ Fixed some errors in README
  • Loading branch information
Download committed Feb 4, 2021
1 parent 855b6f8 commit 1bf186e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -399,12 +399,13 @@ Formats come in two flavors:

**dynamic**

Dynamic formatters have full access to the message. But they do mess up the call stack. A dynamic formatter has this signature:
Dynamic formats have full access to the message. But they do mess up the call stack. A dynamic format has this signature:

```js
ulog.use({
formatters: {
dynamicFormatter: function(ctx) {
use: [ require('ulog/mods/formats') ],
format: {
dynamicFormat: function(ctx) {
// one-time init here
return function(rec) {
// rec.message contains full message
Expand All @@ -417,14 +418,15 @@ ulog.use({

**static**

Static formatters do not have access to the message. But they do not break the call stack! So prefer static formatters if possible.
Static formats do not have access to the message. But they do not break the call stack! So prefer static formats if possible.

Static formatters have this signature:
Static formats have this signature:

```js
ulog.use({
formatters: {
staticFormatter: function(ctx, rec) {
use: [ require('ulog/mods/formats') ],
format: {
staticFormat: function(ctx, rec) {
// one-time init here
return function(){
// rec.message is undefined
Expand Down Expand Up @@ -488,9 +490,7 @@ You can easily add your own custom format to the list above. To do so, just `ulo
```js
var ulog = require('ulog')
ulog.use({
use: [
require('ulog/mods/formats')
],
use: [ require('ulog/mods/formats') ],
formats: {
cool: function(ctx) {
return function(rec) {
Expand Down Expand Up @@ -624,21 +624,21 @@ log_output=my:*,-my:lib=console

### Config option `log_drain`

Specify the name of the output logs should be drained to. Defaults to `drain`.
When log messages are filtered out, they are sent to the drain instead of to the normal output. The default `drain` output is just a noop, but you could override this to send them to a separate file for example.
Specify the name of the output logs should be drained to. Defaults to `noop`.
When log messages are filtered out, they are sent to the drain instead of to the normal output. The default `noop` output is just a noop, but you could override this to send them to a separate file for example.

```sh
log_drain=my:*,-my:lib=console
log_drain=my:*,-my:lib=noop
```

### Config option `log_format`

Specify the format to use. Defaults to `lvl name message perf` on Node JS and `lvl name perf` on browsers.

```sh
log_format=lvl name perf message;some-lib=none;my:*=lvl name perf
log_format=lvl name perf message;my:*=lvl name perf
```
This sets `lvl name perf message` as the default format, while assigning `none` to `some-lib` and a different format string to all loggers starting with `my:`.
This sets `lvl name perf message` as the default format, while assigning a different format string to all loggers starting with `my:`.

For more details, refer to the [section on formatting](#formatting)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ulog",
"version": "2.0.0-beta.12",
"version": "2.0.0-beta.13",
"description": "The universal logger",
"main": "./ulog.js",
"unpkg": "ulog.min.js",
Expand Down

0 comments on commit 1bf186e

Please sign in to comment.