Update README.md

This commit is contained in:
Jonatan Nilsson 2021-06-02 21:59:00 +00:00
parent 97765f09a5
commit 5937469265

View file

@ -1,10 +1,7 @@
[![npm version](https://img.shields.io/npm/v/bunyan.svg?style=flat)](https://www.npmjs.com/package/bunyan)
[![Build Status](https://travis-ci.org/trentm/node-bunyan.svg?branch=master)](https://travis-ci.org/trentm/node-bunyan)
Bunyan is **a simple and fast JSON logging library** for node.js services:
Bunyan-lite is **a simple and fast JSON logging library** for node.js services that contains zero dependencies:
```js
var bunyan = require('bunyan');
var bunyan = require('bunyan-lite');
var log = bunyan.createLogger({name: "myapp"});
log.info("hi");
```
@ -23,7 +20,6 @@ record (see below).
<!-- toc -->
- [Current Status](#current-status)
- [Installation](#installation)
- [Features](#features)
- [Introduction](#introduction)
@ -62,31 +58,10 @@ record (see below).
<!-- tocstop -->
# Current Status
Stable. I do my best to follow semver: i.e. you should only need to worry
about code breaking for a *major* version bump. Bunyan currently supports node
0.10 and greater. Follow <a href="https://twitter.com/intent/user?screen_name=trentmick"
target="_blank">@trentmick</a> for updates to Bunyan.
There is an email discussion list
[bunyan-logging@googlegroups.com](mailto:bunyan-logging@googlegroups.com),
also [as a forum in the
browser](https://groups.google.com/forum/?fromgroups#!forum/bunyan-logging).
Active branches:
- "1.x" is for 1.x maintenance work, if any. 1.x releases are still "latest" in
npm.
- "master" is currently for coming Bunyan 2.x work. For now, 2.x releases are
published to npm with the "beta" tag, meaning that `npm install bunyan` is
still 1.x for now. To install 2.x use `npm install bunyan@2` or
`npm install bunyan@beta`.
# Installation
```sh
npm install bunyan
npm install bunyan-lite
```
**Tip**: The `bunyan` CLI tool is written to be compatible (within reason) with
@ -118,7 +93,7 @@ named after the logging levels:
```js
// hi.js
var bunyan = require('bunyan');
var bunyan = require('bunyan-lite');
var log = bunyan.createLogger({name: 'myapp'});
log.info('hi');
log.warn({lang: 'fr'}, 'au revoir');
@ -140,7 +115,7 @@ $ node hi.js
## Constructor API
```js
var bunyan = require('bunyan');
var bunyan = require('bunyan-lite');
var log = bunyan.createLogger({
name: <string>, // Required
level: <level name or number>, // Optional, see "Levels" section
@ -295,7 +270,7 @@ be exactly as on the parent logger with the addition of the `widget_type`
field:
```js
var bunyan = require('bunyan');
var bunyan = require('bunyan-lite');
var log = bunyan.createLogger({name: 'myapp'});
function Wuzzle(options) {
@ -637,7 +612,7 @@ Pretty-printed:
## Core fields
- `v`: Required. Integer. Added by Bunyan. Cannot be overridden.
This is the Bunyan log format version (`require('bunyan').LOG_VERSION`).
This is the Bunyan log format version (`require('bunyan-lite').LOG_VERSION`).
The log version is a single integer. `0` is until I release a version
"1.0.0" of node-bunyan. Thereafter, starting with `1`, this will be
incremented if there is any backward incompatible change to the log record
@ -741,7 +716,7 @@ manage the stream. A Bunyan Logger instance has one or more streams.
In general streams are specified with the "streams" option:
```js
var bunyan = require('bunyan');
var bunyan = require('bunyan-lite');
var log = bunyan.createLogger({
name: "foo",
streams: [
@ -778,7 +753,7 @@ After a bunyan instance has been initialized, you may add additional streams by
calling the `addStream` function.
```js
var bunyan = require('bunyan');
var bunyan = require('bunyan-lite');
var log = bunyan.createLogger('myLogger');
log.addStream({
name: "myNewStream",
@ -1099,7 +1074,7 @@ To use a RingBuffer:
```js
/* Create a ring buffer that stores the last 100 records. */
var bunyan = require('bunyan');
var bunyan = require('bunyan-lite');
var ringbuffer = new bunyan.RingBuffer({ limit: 100 });
var log = bunyan.createLogger({
name: 'foo',
@ -1307,7 +1282,7 @@ script.
2. An example script using Bunyan, "play.js":
```js
var bunyan = require('bunyan');
var bunyan = require('bunyan-lite');
var log = bunyan.createLogger({name: 'play', level: 'debug'});
log.trace('this one does not emit');
log.debug('hi on debug'); // console.log