Coder Social home page Coder Social logo

duan602728596 / koa-log4js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dominhhai/koa-log4js

0.0 2.0 0.0 25 KB

log4js-node supports Koa-middleware

Home Page: https://www.npmjs.com/package/koa-log4

License: MIT License

JavaScript 100.00%

koa-log4js's Introduction

koa-log4js

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

Forked from koa-log4js.

Note

This branch is use to Koa v2.x. To use Koa v0.x & v1.x, please check the master 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 v2.

Others

See here for more info.

koa-log4js's People

Contributors

dominhhai avatar duan602728596 avatar sunilwang avatar diegocrzt avatar minhhaido avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.