8000 GitHub - dominhhai/koa-log4js at master · GitHub
[go: up one dir, main page]

Skip to content

About

log4js-node supports Koa-middleware

Topics

Resources

Stars

82 stars

Watchers

2 watching

Forks

 
 

Latest commit

 

History

21 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

koa-log4js

A wrapper for log4js-node which support Koa logger middleware. Log message is forked from Express (Connect) logger file.

Note

This branch is use to Koa v0.x & v1.x. To use Koa v2.x, please check the v2.x branch.

Installation

for koa v0.x & v1.x

$ npm i --save koa-log4@1

for koa v2.x

$ npm i --save koa-log4@2

The default logger is for koa v2.x

$ npm i --save koa-log4

Usage

Config koa-log4js is same as the original log4js-node.

Normal log4js way

This way is same as the original log4js-node.

const log4js = require('koa-log4')

const log = log4js.getLogger('index')
log.info('index do some awesome things')

Koa-middleware way

Similar to use Express (Connect) logger middleware.

const log4js = require('koa-log4')
app.use(log4js.koaLogger(log4js.getLogger("http"), { level: 'auto' }))

Full Example

Check this repo for full example with Koa v1

Others

See here for more info.

About

log4js-node supports Koa-middleware

Topics

Resources

Stars

82 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages

0