This is a
playground to test code. It runs a full
Node.js environment and already has all of
npm’s 1,000,000+ packages pre-installed, including
koa-accesslog with all
npm packages installed. Try it out:
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.
Output Common Log Format access logs to any stream. Defaults to
# npm .. npm i koa-accesslog # yarn .. yarn add koa-accesslog
const Koa = require('koa'); const accesslog = require('koa-accesslog'); const app = new Koa(); app.use(accesslog());
127.0.0.1 - - [19/Nov/2014:13:47:37 +0100] "GET / HTTP/1.X" 404 -
You may configure Accesslog to use any writable stream such as an
stream.PassThrough as seen below.
const log = new stream.PassThrough(); app.use(accesslog(log));