rocwind / kv-logger

a tiny logger that supports log with k-v params

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

kv-logger Node.js CI


a tiny logger that supports log with k-v params.

Install

npm install --save kv-logger

Usage Example

// es module
import { logger } from 'kv-logger';
// or common module
const { logger } = require('kv-logger');

logger.info('info message');
logger.warn('warning message', {
    user_id: 123,
});

const loggerWithContext = logger.bindContext({ match_id: 12345 });
loggerWithContext.error('error message with context');

check out more examples at: example.js

About

a tiny logger that supports log with k-v params

License:MIT License


Languages

Language:TypeScript 81.0%Language:JavaScript 19.0%