Skip to content
mike edited this page Apr 26, 2020 · 7 revisions

Logger

All actions which occur in Sirius (create indexes, binding, etc) will be logged.

For example, on an application start (TodoMVC)

INFO: [APPLICATION] Logger is enabled? true
INFO: [APPLICATION] Adapter: JQueryAdapter

available options

  1. enable_logging - enable or disable logs
  2. log_to - method for writing all messages in application
  3. minimum_log_level - by default is debug

For enable logging use enable_logging option.

Sirius.Application.run({enable_logging: true})

By default Sirius writes all logs with console.log method. You can redefine this:

// log levels: DEBUG, INFO, WARN, ERROR

my_logger = function(log_level, log_source, message) {
  if (log_source == "MyController" && log_level == "ERROR")
    ajax.send(message); // send on server all ERROR logs
}

Sirius.Application.run({
  log_to: my_logger
})

If you want to use logger into controller actions:

Controller = 
  logger: Sirius.Application.get_logger("Controller")
  action: (params) ->
    @logger.info("start action")
Clone this wiki locally