New log backend.
This commit is contained in:
parent
8ad7c46b8a
commit
01dcf0a971
1 changed files with 34 additions and 0 deletions
34
app/assets/javascripts/app/lib/app_init/log.js.coffee
Normal file
34
app/assets/javascripts/app/lib/app_init/log.js.coffee
Normal file
|
@ -0,0 +1,34 @@
|
|||
class App.Log
|
||||
_instance = undefined
|
||||
|
||||
# @sub: (module) ->
|
||||
# @module: (name) ->
|
||||
|
||||
@log: ( module, level, args... ) ->
|
||||
if _instance == undefined
|
||||
_instance ?= new _Singleton
|
||||
_instance.log( module, level, args )
|
||||
|
||||
@debug: ( module, level, args... ) ->
|
||||
if _instance == undefined
|
||||
_instance ?= new _Singleton
|
||||
_instance.log( module, level, args )
|
||||
|
||||
|
||||
class _Singleton
|
||||
constructor: ->
|
||||
console.log 'NNNNNNNEEEWWW LOG!!!'
|
||||
@config = {}
|
||||
# Session: true
|
||||
# ControllerForm: true
|
||||
|
||||
log: ( module, level, args ) ->
|
||||
if !@config || level isnt 'debug'
|
||||
@_log( module, level, args )
|
||||
else if @config[ module ]
|
||||
@_log( module, level, args )
|
||||
|
||||
|
||||
_log: ( module, level, args ) ->
|
||||
console.log "App.#{module}(#{level})", args
|
||||
|
Loading…
Reference in a new issue