Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including @libshin/koa-logger with all npm packages installed. Try it out:

var koaLogger = require("@libshin/koa-logger")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@libshin/koa-logger v1.0.0

Morgan like logger for koa

TL;DR

Logger for koa

Installation

npm

$ npm i --save @libshin/koa-logger

yarn

$ yarn add @libshin/koa-logger

How to use

const Koa = require("koa");
const logger = require("@libshin/koa-logger");

const app = new Koa();

if (process.env.NODE_ENV !== "production") {
  app.use(logger);
}

app.use(async ctx => {
  ctx.body = "Hello World";
});

const DEFAULT_PORT = 3000;
const PORT = process.env.PORT || DEFAULT_PORT;

app.listen(PORT);

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free