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.alpha.55 source/joosy/modules/log.coffee
joosy-1.2.0.alpha.54 source/joosy/modules/log.coffee
joosy-1.2.0.alpha.53 source/joosy/modules/log.coffee
joosy-1.2.0.alpha.52 source/joosy/modules/log.coffee
joosy-1.2.0.alpha.51 source/joosy/modules/log.coffee