Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/adherentman/koa-logger-bunyan

koa日志记录器的中间件 基于 bunyan
https://github.com/adherentman/koa-logger-bunyan

bunyan bunyan-logger koa-logger koa2 logger-middleware

Last synced: about 2 months ago
JSON representation

koa日志记录器的中间件 基于 bunyan

Awesome Lists containing this project

README

        

# Koa middleware for logging using bunya

## Refer to

- [bunyan-logger](https://github.com/koajs/bunyan-logger)
- [koa-json-logger](https://github.com/rudijs/koa-json-logger)

## Ues

```javascript
var koaLogger = require('koa-logger-bunyan');

app.use(koaLogger())
```

Else You want customize

```javascript
var koaLogger = require('koa-logger-bunyan');

app.use(koaLogger({
name: , // Required
level: , // Optional, see "Levels" section
stream: , // Optional, see "Streams" section
streams: [, ...], // Optional, see "Streams" section
serializers: , // Optional, see "Serializers" section
src: , // Optional, see "src" section

// Any other fields are added to all log records as is.
foo: 'bar',
...
}))
```

For specific use, please refer to https://github.com/trentm/node-bunyan.

## Result
![](https://blogaaaaxzh.oss-cn-hangzhou.aliyuncs.com/logger-bunyan.png)

## Todo
- [x] customize
- [ ] test