@thesuhu/colorconsole

1.0.5 • Public • Published

colorconsole

npm license

Make console log more colorful. While developing, we often deal with console logs. This module provides four templates namely regular log, error log, HTTP log and SQL log.

Install

npm install @thesuhu/colorconsole --save-dev

Usage

Below is an example regular and error log.

const { logConsole, errorConsole } = require('@thesuhu/colorconsole')

// regular log
logConsole('Hello world!')

// error log
errorConsole('A very cool error here')

Below is an example HTTP log.

const { httpLogConsole } = require('@thesuhu/colorconsole')

// log request for dev
app.use((req, res, next) => {
  if (env == 'dev') httpLogConsole(req)
  next()
})

Below is an example SQL log.

const { sqlLogConsole } = require('@thesuhu/colorconsole')

// when work with MySQL
let query = mysql.format(sql, param)
if (env == 'dev') {
    sqlLogConsole(query)
}

// when work with Oracle
let query = queryBindToString(sql, param)
if (env == 'dev') {
    sqlLogConsole(query)
}

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i @thesuhu/colorconsole

Weekly Downloads

194

Version

1.0.5

License

MIT

Unpacked Size

5.91 kB

Total Files

5

Last publish

Collaborators

  • thesuhu