@barrygee/nodelogger

Node JS Simple Logger

Usage no npm install needed!

<script type="module">
  import barrygeeNodelogger from 'https://cdn.skypack.dev/@barrygee/nodelogger';
</script>

README

NodeLogger

A custom logger for Node.js

Available fields

{
    "level": String: (0-4) this is converted to TRACE, DEBUG, INFO, WARN, ERROR
    "serviceName": String,
    "uuid": String,
    "class": String,
    "function": String,
    "message": String
}

Example log object containing specified values:

logger.log({ level: '3', serviceName: 'some-service-name', uuid: '12341234-UUID-UUID-123412341234', class: 'a-js-class.js' function: 'someFunction()', message: 'A message' })

Outputs:

2018-10-11T06:48:13.166Z WARN some-service-name 12341234-UUID-UUID-123412341234 a-js-class.js someFunction() A message

Missing fields will be populated with the default values specified in logger.config.json.

Log object containing default values specified in logger.config.json:

logger.log()