Skip to content
Grant Carthew edited this page May 23, 2018 · 8 revisions

perj separatorString Option

The separatorString option allows you to customize the string used to separate child top level properties.

Type: String

Default: :

Valid: Any String but keep it short.

Description:

If you create a Top Level Property key with a value of a string, then use the same key when you create a child logger, the separatorString is inserted between the parent and child string values.

For this to work you must meet these requirements:

  • Create a Top Level Property when creating either a root or child logger.
  • Remember the key name you used.
  • Ensure the key contains a string value.
  • Use the same key name when you create child loggers from the parent.

Example

This example :

const perj = require('../perj')
const host = require('os').hostname()
const pid = process.pid
const file = require('path').basename(module.filename)
const name = 'full'
const passThrough = true

const log = perj.create({ component: 'app' })
log.info('example text for logging', { foo: 'bar' })

/*

Console output will be:

[2018-05-03T02:46:54.611Z][info][full](Dev:7094:console-full.js) example text for logging
{
  "foo": "bar"
}

*/