<commit_before>class ObjectLogger

  constructor:(@className, @defaultLevel = 'info')->

    @log = loglevel.createLogger(@className, @defaultLevel)

    @callStack = []

    @log.enter = @enter.bind(@, 'debug')
    @log.fineEnter = @enter.bind(@, 'fine')
    @log.return = @return.bind(@, 'debug')
    @log.fineReturn = @return.bind(@, 'fine')

    return @log

  enter: (level, args...)->
    throw new Error ('ObjectLogger: No method name provided to enter') if args.length is 0
    methodName = args.shift()
    @callStack.unshift methodName
    @log.setPrefix "#{@className}.#{methodName}:"
    args.unshift 'ENTER'
    @log[level].apply @log, args

  return: (level)->
    @log[level].call @log, 'RETURN'
    @callStack.shift()
    if @callStack.length > 0
      methodName = @callStack[0]
      @log.setPrefix "#{@className}.#{methodName}:"<commit_msg>Fix method bind problems in phantomjs<commit_after>class ObjectLogger

  constructor:(@className, @defaultLevel = 'info')->

    @log = loglevel.createLogger(@className, @defaultLevel)

    @callStack = []

    @log.enter = @bindMethod(@enter, 'debug')
    @log.fineEnter = @bindMethod(@enter, 'fine')
    @log.return = @bindMethod(@return, 'debug')
    @log.fineReturn = @bindMethod(@return, 'fine')

    return @log

  enter: (level, args...)->
    throw new Error ('ObjectLogger: No method name provided to enter') if args.length is 0
    methodName = args.shift()
    @callStack.unshift methodName
    @log.setPrefix "#{@className}.#{methodName}:"
    args.unshift 'ENTER'
    @log[level].apply @log, args

  return: (level)->
    @log[level].call @log, 'RETURN'
    @callStack.shift()
    if @callStack.length > 0
      methodName = @callStack[0]
      @log.setPrefix "#{@className}.#{methodName}:"


  bindMethod: (method, level) ->
    if typeof method.bind == 'function'
      return method.bind(@, level)
    else
      try
        return Function::bind.call(method, @, level)
      catch e
      # Missing bind shim or IE8 + Modernizr, fallback to wrapping
        console.log 'Missing bind shim or IE8 + Modernizr, fallback to wrapping'
        return (args...)=>
          args.unshift(level)
          Function::apply.apply method, [
            @
            args
          ]
{'fraction_non_alphanumeric': 0.1543594306049822, 'fraction_numerical': 0.0035587188612099642, 'mean_word_length': 3.03770197486535, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5587914', 'n_tokens_mistral': 726, 'n_tokens_neox': 697, 'n_words': 174}