<commit_before>'use strict'

ms    = require 'pretty-ms'
CONST = require './Constants'

module.exports =
  print: ->
    for type of @types
      @transport @generateMessage type, message for message in @messages[type]

  outputMessage: (message) -> message
  outputType: (type, diff = '') ->
    if @align and not @diff then "#{type}#{diff}\t" else "#{type}#{diff} "

  transport: console.log

  generateMessage: (type, message) ->
    return unless @isPrintable type

    colorType   = @types[type].color
    message     = @outputMessage message
    message     = @colorize @types.line.color, message

    keyword     = if @keyword? then @keyword else type
    diff        = null

    if @diff
      if @diff[type]
        diff = new Date() - @diff[type]
        diff = if diff > CONST.MIN_DIFF_MS then ms diff else "#{diff}ms"
        @diff[type] = new Date()
        diff = " +#{diff}"
      else
        @diff[type] = new Date()

    messageType = @outputType keyword, diff
    messageType = @colorize colorType, messageType
    messageType + message

  generateTypeMessage: (type) ->
    (message...) =>
      message = @format message
      @transport @generateMessage type, message
      this

  keyword: null
  diff: false
  align: true
  color: true

  level: CONST.UNMUTED

  types:
    line:
      color: 'gray'
    error:
      level : 0
      color : 'red'
    warn:
      level : 1
      color : 'yellow'
    success:
      level : 2
      color : 'green'
    info:
      level : 3
      color : 'white'
    verbose:
      level : 4
      color : 'cyan'
    debug:<commit_msg>bye fat arrow<commit_after>'use strict'

ms    = require 'pretty-ms'
CONST = require './Constants'

module.exports =
  print: ->
    for type of @types
      @transport @generateMessage type, message for message in @messages[type]

  outputMessage: (message) -> message
  outputType: (type, diff = '') ->
    if @align and not @diff then "#{type}#{diff}\t" else "#{type}#{diff} "

  transport: console.log

  generateMessage: (type, message) ->
    return unless @isPrintable type

    colorType   = @types[type].color
    message     = @outputMessage message
    message     = @colorize @types.line.color, message

    keyword     = if @keyword? then @keyword else type
    diff        = null

    if @diff
      if @diff[type]
        diff = new Date() - @diff[type]
        diff = if diff > CONST.MIN_DIFF_MS then ms diff else "#{diff}ms"
        @diff[type] = new Date()
        diff = " +#{diff}"
      else
        @diff[type] = new Date()

    messageType = @outputType keyword, diff
    messageType = @colorize colorType, messageType
    messageType + message

  generateTypeMessage: (type) ->
    (message...) ->
      message = @format message
      @transport @generateMessage type, message
      this

  keyword: null
  diff: false
  align: true
  color: true

  level: CONST.UNMUTED

  types:
    line:
      color: 'gray'
    error:
      level : 0
      color : 'red'
    warn:
      level : 1
      color : 'yellow'
    success:
      level : 2
      color : 'green'
    info:
      level : 3
      color : 'white'
    verbose:
      level : 4
      color : 'cyan'
    debug:
{'fraction_non_alphanumeric': 0.11627906976744186, 'fraction_numerical': 0.0031426775612822125, 'mean_word_length': 2.22165991902834, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '7513459', 'n_tokens_mistral': 1005, 'n_tokens_neox': 972, 'n_words': 303}