Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface LoxerOptions

Options for the {@link Loxer.init} method

Hierarchy

  • LoxerOptions

Properties

Optional modules

modules: LoxerModules

An object containing all loggable modules

an exemplary module "Persons" would look like this:

  PERS: { fullName: 'Persons', color: '#0ff', devLevel: 3, prodLevel: 1 }
  • the key PERS will be used to reference the module in the logs and is kept short for laziness
  • the fullName will be (possibly sliced - see LoxerConfig.moduleTextSlice) displayed as the very first string at the output
  • the color will be applied to the module name and its box layout
  • the levels are activation boundaries for the specified logs. All logs that have a level higher than the current module level will therefore not be logged.

Given Default Modules

Some default modules will be set and can be overwritten here:

The NONE module

will be automatically set when there is no .module(...) chained on Loxer.log(), Loxer.open() or Loxer.of() when the opening log had no module too. The default is defined as:

  NONE: { fullName: '', color: '#fff', devLevel: 1, prodLevel: 1 }

This module will not have a module name or a box layout at the output.

The DEFAULT module

will be automatically set when Loxer.log() or Loxer.open() logs are chained with an empty .module(). The default is defined as:

  DEFAULT: { fullName: '', color: '#fff', devLevel: 1, prodLevel: 1 }

This module will have an empty module name, but a box layout at the output.

The INVALID module

will be automatically set when any given module does not exist (as a key) in the given LoxerOptions.modules in the Loxer.init(options). This module is a visual indicator for misspelled or missing moduleIds. Additionally this module is serves as a fallback mechanism and should therefore never be overwritten with undefined! The default is defined as:

  INVALID: { fullName: 'INVALIDMODULE', color: '#f00', devLevel: 1, prodLevel: 0 }

This module will have a moduleName (INVALIDMODULE), but no box layout at the output.

Optional dev

dev: boolean

determines if Loxer is running in a development or production environment.

  • you can pass any boolean expression here
  • process.env.NODE_ENV === 'development' is common for NodeJS
  • __DEV__ is common for react-native
  • defaults to process.env.NODE_ENV === 'development'

Optional callbacks

callbacks: LoxerCallbacks

Functions called as an output stream for Loxer.. The output stream is divided into 4 different streams, depending on the environment and the type of log:

  • devLog: logs occurring in development environment
  • prodLog: logs occurring in production environment
  • devError: errors occurring in development environment
  • prodError: errors occurring in production environment

Optional config

config: LoxerConfig

The Configuration of Loxer.

Optional defaultLevels

defaultLevels: object

The default levels to show logs in production or development. These will automatically be adapted to the default module NONE and DEFAULT. If you want to set them differently, then you have to override them in the modules option.

  • both default to devLevel: 1 and prodLevel: 0

Type declaration

  • devLevel: LevelType

    the actual level to show logs in development mode

  • prodLevel: LevelType

    the actual level to show logs in production mode

Generated using TypeDoc