Sha256: f5a6a70048fe954b0d0001227c24ece2d32682cb8a023dd7c4eefcf9b0b86c3c

Contents?: true

Size: 885 Bytes

Versions: 3

Compression:

Stored size: 885 Bytes

Contents

#
# Wrappers for console.log
#
# @mixin
#
Joosy.Modules.Log =
  
  #
  # Checks if console is available and proxies given arguments directly to `console.log`
  #
  log: (args...) ->
    return unless console?

    if console.log.apply?
      args.unshift "Joosy>"
      console.log args...
    else
      console.log args.first()

  #
  # Runs `log` if debug is active
  #
  debug: (args...) ->
    return unless Joosy.Application.debug
    @log args...

  #
  # Logs given message wrapping it with description of given object (class name)
  #
  # @param [Object] context           The class required to be described in log message
  # @param [String] string            Message to log
  #
  debugAs: (context, string, args...) ->
    return unless Joosy.Application.debug
    context = Joosy.Module.__className(context) || 'unknown context'
    @debug "#{context}> #{string}", args...

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
joosy-1.0.0.RC4 app/assets/javascripts/joosy/core/modules/log.js.coffee
joosy-1.0.0.RC3 app/assets/javascripts/joosy/core/modules/log.js.coffee
joosy-1.0.0.RC2 app/assets/javascripts/joosy/core/modules/log.js.coffee