@cappalyst/klog

Middleware for common log format access logs

Usage no npm install needed!

<script type="module">
  import cappalystKlog from 'https://cdn.skypack.dev/@cappalyst/klog';
</script>

README

klog

Output Common Log Format access logs to any stream. Defaults to process.stdout.

Install

npm install @cappalyst/klog --save

Usage

CommonJS

var Koa = require('koa');
var klog = require('@cappalyst/klog');
var app = new Koa();

app.use(klog());

ES6

import Koa from 'koa'
import klog from '@cappalyst/klog'

const app = new Koa()

app.use(klog())

Output

::1 - - [10/Sep/2018:16:46:58 +0200] "GET / HTTP/1.x" 404 -

Configure

You may configure klog to use any writable stream such as an instance of stream.PassThrough as seen below.

var log = new stream.PassThrough();
app.use(klog({ stream: log }));

License

MIT