Skip to content

2.5 Lunar.Logger

Caio Vaccaro edited this page Apr 14, 2016 · 1 revision

Lunar().Logger

Description:

Its purpose is to give additional insights during development. The Logger does not work in production mode. It have the following methods:

import Lunar from 'orbitjs'

const Logger = Lunar().Logger

Logger.getLevel()
Logger.setLevel()
Logger.log()

getLevel()

This method returns a "string" of the current log level (eg. "OFF").

setLevel(wantedLevel)

This method accepts a "string" and will update the log level accordingly. Available levels are:

  • OFF: No logs will be displayed.
  • FATAL: Only fatal errors will be displayed.
  • ERROR: All kinds of errors.
  • WARN: All of the above and warnings.
  • ALL: Any kind of log will be displayed.

log([{ message=null, level='OFF' }])

Accepts both "object" and an "array" of such, with a "message" and the "level" of it. The result is a regular "console.log" if the current "level" corresponds to the message level.

Clone this wiki locally