1.1.0 • Published 7 years ago

node-os-log v1.1.0

Weekly downloads
1
License
MIT
Repository
-
Last release
7 years ago

Installation

Install the package using
npm i dbcustomlog

To add it as a dependency, use
yarn add dbcustomlog or npm i -S dbcustomlog

Once installed, require the package with

const logger = require('dbcustomlog')
const log = new logger()

Usage

Call one of the following functions or shortcuts for different levels of warning.

i or info
s or success
e or error
c or command
w or warn

Example Call

log.i(msg)
// Where msg is the message you want to log

File Output

To output to a file, pass the file path as an argument when creating the new class

// Example
const path = require('path')
const log = new logger(path.join(__dirname, 'default.log'))

Examples

// Info
log.i("Log Message")
// Debug
log.s("Log Message")
// Error
log.e("Log Message")
// Verbose
log.c("Log Message")
// Warn
log.w("Log Message")

Would Output

[INFO]    [01/01/1970 00:00:00] Log Message
[SUCCESS]   [01/01/1970 00:00:00] Log Message
[ERROR]   [01/01/1970 00:00:00] Log Message
[COMMAND] [01/01/1970 00:00:00] Log Message
[WARN]    [01/01/1970 00:00:00] Log Message