Sha256: 46966a82a5c0417b3e9dad37ca179712e3ab5f200c26863dbb571e7a53200392

Contents?: true

Size: 968 Bytes

Versions: 25

Compression:

Stored size: 968 Bytes

Contents

#= require joosy/joosy

#
# 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.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.debug()
    context = Joosy.Module.__className(context) || 'unknown context'
    @debug "#{context}> #{string}", args...

# AMD wrapper
if define?.amd?
  define 'joosy/modules/log', -> Joosy.Modules.Log

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
joosy-1.2.0.rc.2 source/joosy/modules/log.coffee
joosy-1.2.0.rc.1 source/joosy/modules/log.coffee
joosy-1.2.0.beta.4 source/joosy/modules/log.coffee
joosy-1.2.0.beta.3 source/joosy/modules/log.coffee
joosy-1.2.0.beta.2 source/joosy/modules/log.coffee
joosy-1.2.0.beta.1 source/joosy/modules/log.coffee
joosy-1.2.0.alpha.73 source/joosy/modules/log.coffee
joosy-1.2.0.alpha.71 source/joosy/modules/log.coffee
joosy-1.2.0.alpha.70 source/joosy/modules/log.coffee
joosy-1.2.0.alpha.68 source/joosy/modules/log.coffee
joosy-1.2.0.alpha.67 source/joosy/modules/log.coffee
joosy-1.2.0.alpha.66 source/joosy/modules/log.coffee
joosy-1.2.0.alpha.65 source/joosy/modules/log.coffee
joosy-1.2.0.alpha.64 source/joosy/modules/log.coffee
joosy-1.2.0.alpha.63 source/joosy/modules/log.coffee
joosy-1.2.0.alpha.62 source/joosy/modules/log.coffee
joosy-1.2.0.alpha.59 source/joosy/modules/log.coffee
joosy-1.2.0.alpha.58 source/joosy/modules/log.coffee
joosy-1.2.0.alpha.57 source/joosy/modules/log.coffee
joosy-1.2.0.alpha.56 source/joosy/modules/log.coffee