• Jump To … +
    Nodulator.ls ClientDB.ls index.ls Resource.ls Bus.ls Cache.ls ChangeWatcher.ls Debug.ls Wrappers.ls Nodulator.ls Resource.ls Schema.ls NModule.ls AccountResource.ls User.ls index.ls Nodulator-Angular.ls TaskDirective.ls index.ls TaskService.ls main.ls index.ls index.ls Task.ls index.ls index.ls index.ls index.ls index.ls DOM.ls View.ls index.ls Nodulator.ls Mongo.ls Mysql.ls SqlMem.ls index.ls Resource.ls Request.ls Route.ls index.ls
  • Debug.ls

  • ¶
    require! debug
    
    debug.depth = 0
    debug.longuest = 0
    class Debug
    
      @depthActivated = false
    
      depthStr: ''
    
      @colors =
        cyan: debug.colors[0]
        green: debug.colors[1]
        yellow: debug.colors[2]
        blue: debug.colors[3]
        purple: debug.colors[4]
        red: debug.colors[5]
    
      (it, color = debug.colors[1], objDebug = false) ->
        @name = it
    
        debug.longuest = max debug.longuest, it.length + 7
    
        @_out = debug it + '::Log'
          ..color = debug.useColors && color
        @_outWarn = debug it + '::Warn'
          ..color = debug.useColors && @@colors.yellow
        @_outError = debug it + '::Error'
          ..color = debug.useColors && @@colors.red
    
      _DepthStr: -> ['.' for i from 0 til debug.depth]*''
      _Padding: -> [' ' for i from 0 til debug.longuest - @name.length - it]*''
    
      Log: -> @_out @_Padding(5) + @_DepthStr! + it
      Warn: -> @_outWarn @_Padding(6) + @_DepthStr! + it
      Error: -> @_outError @_Padding(7) + @_DepthStr! + it
    
      @Depth = -> debug.depth = debug.depth + 1 if @depthActivated
      @UnDepth = -> debug.depth = debug.depth - 1 if @depthActivated
    
    module.exports = Debug
  • ¶

    Add debug for objects with utils.debug