Optionalmodulesan exemplary module "Persons" would look like this:
PERS: { fullName: 'Persons', color: '#0ff', devLevel: 'debug', prodLevel: 'warn' }
PERS will be used to reference the module in the logs and is kept short for laziness'info'
logs 'error', 'warn' and 'info' logs and stops before 'debug'Some default modules will be set and can be overwritten here:
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: 'info', prodLevel: 'error' }
This module will not have a module name or a box layout at the output.
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: 'info', prodLevel: 'error' }
This module will have an empty module name, but a box layout at the output.
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: 'info', prodLevel: 'error' }
This module will have a moduleName (INVALIDMODULE), but no box layout at the output.
The accepted ids follow the LoxerModuleRegistry: while it is empty, every module id is
an ordinary string. Register the modules of your project and this object has to define
exactly them - see RegisteredModules.
Optionaldevdetermines if Loxer is running in a development or production environment.
process.env.NODE_ENV === 'development' is common for NodeJS__DEV__ is common for react-nativeprocess.env.NODE_ENV === 'development'OptionaloutputReceives every visible log and error as a typed output event. When it is absent, Loxer renders development events to the console and keeps production events silent.
OptionalconfigThe Configuration of Loxer.
OptionaldefaultThe levels the default modules NONE and DEFAULT log up to, in production or development. If
you want them set differently, override those modules in the modules option.
devLevel: 'info' and prodLevel: 'error'
Options for the Loxer.init method
The type parameter carries the concrete LoxerOptions.modules object and is inferred, so
LoxerOptionscan be named without it - as the target of aconst options = { ... } satisfies LoxerOptions, for example.