Skip to content

Application & Settings

mike edited this page Apr 26, 2020 · 4 revisions

enable_logging - disable or enables logs, default: false

minimum_log_level - minimum level of loggin in an application, default is: debug

log_to - custom logger, how to write logs in an application. default is:

default_log_function: (level, log_source, message) ->
  if console && console.log
    console.log "#{level} [#{log_source}]: #{message}"
  else
    alert "Not supported `console`. You should define own `logger` function for a Sirius.Application"

adapter - default application adapter, default is `VanillaJsAdapter`

route - user defined routing, default: `{}`, [see](https://github.com/fntz/sirius/wiki/Controllers-and-Routing)

start - root URL for an application, default is `false`. Sirius will redirect to the `start` URL by self.

controller_wrapper - shared methods for your controllers, default: `{redirect: Sirius.redirect}`, see [Controllers page](https://github.com/fntz/sirius/wiki/Controllers-and-Routing)

ignore_not_matched_urls - default `true`, when true, on click will be redirect to url, when false, generate ‘application:404’ event

settings = {
  ... 
}

Sirius.Application.run 
  settings

Useful methods

get current adapter:

Sirius.Application.get_adapter().and_then (adapter) -> 
  

get logger

logger = Sirius.Application.get_logger("MyController")
logger.info("my_application log")
Clone this wiki locally