<commit_before>require 'pp'
require 'highline'

class CoolLogFormater
  include ActiveSupport::TaggedLogging::Formatter

  Colors = {
    'FATAL' => :red,
    'ERROR' => :red,
    'WARN'  => :yellow,
    'INFO'  => :green,
    'DEBUG' => :blue,
  }

  @@highline = HighLine.new

  def call(severity, timestamp, _progname, msg)
    message = if msg.is_a?(String) then
                return '' if msg.empty?
                msg
              else
                msg.pretty_inspect
              end
    time  = "[#{timestamp.strftime("%y/%m/%d %H:%M:%S" )}.#{'%06d' % timestamp.usec.to_s}]"
    level = "[#{@@highline.color(severity, Colors[severity], :bold)}]:"

    level << ' ' if severity == 'WARN' or severity == 'INFO'

    "#{time} #{level} #{message}\n"
  end
end

Rails.logger.formatter = CoolLogFormater.new


# for aws-sdk-v1
AWS.config(logger: Rails.logger, log_formatter: AWS::Core::LogFormatter.colored)

# for aws-sdk-v2
Aws.config[:logger]        = Rails.logger
Aws.config[:log_formatter] = Seahorse::Client::Logging::Formatter.colored<commit_msg>Update celluroid logger.<commit_after>require 'pp'
require 'highline'

class CoolLogFormater
  include ActiveSupport::TaggedLogging::Formatter

  Colors = {
    'FATAL' => :red,
    'ERROR' => :red,
    'WARN'  => :yellow,
    'INFO'  => :green,
    'DEBUG' => :blue,
  }

  @@highline = HighLine.new

  def call(severity, timestamp, _progname, msg)
    message = if msg.is_a?(String) then
                return '' if msg.empty?
                msg
              else
                msg.pretty_inspect
              end
    time  = "[#{timestamp.strftime("%y/%m/%d %H:%M:%S" )}.#{'%06d' % timestamp.usec.to_s}]"
    level = "[#{@@highline.color(severity, Colors[severity], :bold)}]:"

    level << ' ' if severity == 'WARN' or severity == 'INFO'

    "#{time} #{level} #{message}\n"
  end
end

Rails.logger.formatter = CoolLogFormater.new


# for aws-sdk-v1
AWS.config(logger: Rails.logger, log_formatter: AWS::Core::LogFormatter.colored)

# for aws-sdk-v2
Aws.config[:logger]        = Rails.logger
Aws.config[:log_formatter] = Seahorse::Client::Logging::Formatter.colored

Celluloid.logger = Rails.logger
{'fraction_non_alphanumeric': 0.16682027649769585, 'fraction_numerical': 0.003686635944700461, 'mean_word_length': 2.9616788321167884, 'pattern_counts': {'":': 0, '<': 7, '<?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': '5774416', 'n_tokens_mistral': 793, 'n_tokens_neox': 751, 'n_words': 147}