1.0.5 • Published 3 years ago

@thesuhu/colorconsole v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

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

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago