Socket
Book a DemoInstallSign in
Socket

@pgprojectx/alchemy-koa-logging

Package Overview
Dependencies
Maintainers
14
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pgprojectx/alchemy-koa-logging

Provides a uniform logging middleware for [koa](http://koajs.com). Built on [bunyan](https://github.com/trentm/node-bunyan).

1.1.0
latest
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
14
Weekly downloads
 
Created
Source

alchemy-koa-logging

Provides a uniform logging middleware for koa. Built on bunyan.

Installation

yarn add @pgprojectx/alchemy-koa-logging

or

npm install --save @pgprojectx/alchemy-koa-logging

Usage

alchemy-koa-logging requires a base bunyan instance to be provided.

Simple usage:

const Koa = require('koa');
const koaLogger = require('@pgprojectx/alchemy-koa-logging');
const bunyan = require('bunyan');

const logger = bunyan.createLogger({ name: 'my-service' });
const app = new Koa();
app.use(koaLogger(logger));

This will accomplish a few things:

  • A child logger will be created for each request and attached to ctx at ctx.logger.
  • Each request generates a unique identifier to trace. This is automatically attached to the child logger and available at ctx.state.request_id.
  • An access logger will log all requests with standard output.

Example output:

FAQs

Package last updated on 30 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.