Skip to content
Grant Carthew edited this page Oct 25, 2024 · 7 revisions

Method Signature

log.levels

Type: Property Read Only

Get: Returns the current logging levels object.

const levels = log.levels

Example:

import Perj from 'perj'
const log = new Perj(options)
const levels = log.levels

console.dir(levels)
/*

Default levels object:
{
  fatal: 60,
  error: 50,
  warn: 40,
  info: 30,
  debug: 20,
  trace: 10
}

*/

Description

The log.levels property gives you a handle to the levels object. It is a read only property. If you try to assign to it the application will throw an exception.

See the level and levels option documents for more detail.

Examples

Here is a simple example of using the log.levels property:

import Perj from 'perj'
const log = new Perj()

console.dir(log.levels)
/*

Console output:
{
    fatal: 60,
    error: 50,
    warn: 40,
    info: 30,
    debug: 20,
    trace: 10
}

*/

console.log(log.levels.error)
// 50