Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sahilrajput03/logger-npm


https://github.com/sahilrajput03/logger-npm

Last synced: 16 days ago
JSON representation

Awesome Lists containing this project

README

        

# README

**Why?**

- Middleware has coloured output as compared to using morgan's log printing for the requests.
- Simple coloured logs with different levels with matching color schemes i.e., logs related to info, warn and error.
- Prints the line number of the source log instruction as well.

Usage:

```js
# INSTALL
npm i sahilrajput03-logger

# FOR GENERAL LOGGING
const {loggert, logger} = require('sahilrajput03-logger')
const data = {friend: 'mercedes'} // can be anything
logger.warn(data)
logger.info(data)
logger.err(data)

# FOR MIDDLEWARE
const {logMw} = require('@sahil/logger')
app.use(logMw)

# FOR SETTING UP MY FAVOURITE COLORS
const {setupColors} = require('sahilrajput03-logger')
setupColors()

console.log('wowo'.mb) // To view list of available colors you can look into `lib/setupColors.js` file.
```