You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

koa-bunyan-logger

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa-bunyan-logger - npm Package Compare versions

Comparing version

to
2.0.0

18

History.md
2.0.0-pre1 / 2016-04-15
=======================
2.0.0 / 2017-04-14
==================
* Support koa v2 #8 #9 [ifraixedes](https://github.com/ifraixedes)
Thanks to [ifraixedes](https://github.com/ifraixedes) for
updating and refactoring to work with koa 2.x
* Merge pull request #16 from venables/update-uuid-2x
* Merge pull request #15 from marcbachmann/update-uuid
* chore(package): update uuid to version 3.0.0
* Include stdSerializers in custom bunyan logger example
* Merge pull request #12 from umayr/2x
* Update examples
* Merge pull request #11 from kevinawoo/patch-1
* fixed example typo.
* Merge pull request #10 from alxarch/patch-1
* Fix wrong method name
1.3.0 / 2015-10-26

@@ -8,0 +20,0 @@ ==================

2

index.js
'use strict';
var bunyan = require('bunyan');
var uuid = require('node-uuid');
var uuid = require('uuid');
var util = require('util');

@@ -6,0 +6,0 @@ var onFinished = require('on-finished');

{
"name": "koa-bunyan-logger",
"version": "2.0.0-pre1",
"version": "2.0.0",
"description": "Koa middleware for logging requests using bunyan",

@@ -30,4 +30,4 @@ "main": "index.js",

"bunyan": "~1.5.0",
"node-uuid": "~1.4.1",
"on-finished": "~2.1.1"
"on-finished": "~2.1.1",
"uuid": "^3.0.0"
},

@@ -34,0 +34,0 @@ "devDependencies": {

@@ -27,4 +27,5 @@ # bunyan-logger

app.use(function (ctx) {
ctx.log.info({'Got a request from %s for %s', this.request.ip, this.path);
app.use(function (ctx, next) {
ctx.log.info({'Got a request from %s for %s', ctx.request.ip, ctx.path);
return next();
});

@@ -118,3 +119,7 @@

var appLogger = bunyan.createLogger({name: 'myapp', level: 'debug'});
var appLogger = bunyan.createLogger({
name: 'myapp',
level: 'debug',
serializers: bunyan.stdSerializers
});

@@ -161,3 +166,3 @@ app.use(koaBunyanLogger(appLogger));

- formatRequestLog: Function which will be called to generate a log message
- formatRequestMessage: Function which will be called to generate a log message
for logging requests. The function will be called in the context of the

@@ -167,3 +172,3 @@ koa 'this' context and passed the request fields object. It should return

- formatResponseLog: Same as formatRequestLog, but for responses.
- formatResponseMessage: Same as formatRequestLog, but for responses.

@@ -239,3 +244,3 @@ #### Examples

app.use(function (ctx) {
ctx.response.set('X-Server-Request-Id', this.reqId);
ctx.response.set('X-Server-Request-Id', ctx.reqId);
ctx.body = "Hello world";

@@ -242,0 +247,0 @@ });