<commit_before># encoding: utf-8

require 'singleton'

module Nanoc3::CLI

  # Nanoc3::CLI::Logger is a singleton class responsible for generating
  # feedback in the terminal.
  class Logger

    ACTION_COLORS = {
      :create         => "\e[1m" + "\e[32m", # bold + green
      :update         => "\e[1m" + "\e[33m", # bold + yellow
      :identical      => "\e[1m",            # bold
      :skip           => "\e[1m"             # bold
    }

    include Singleton

    # The log level, which can be :high, :low or :off (which will log all
    # messages, only high-priority messages, or no messages at all,
    # respectively).
    attr_accessor :level

    # Whether to use color in log messages or not
    attr_accessor :color
    alias_method :color?, :color

    def initialize
      @level = :high
      @color = true

      # Try enabling color support on Windows
      begin
        require 'Win32/Console/ANSI' if RUBY_PLATFORM =~/mswin|mingw/
      rescue LoadError
        warn 'The win32console gem is not available. Install it to enable color support on Windows.'
        @color = false
      end
    end

    # Logs a file-related action.
    #
    # +level+:: The importance of this action. Can be :high or :low.
    #
    # +action+:: The kind of file action. Can be :create, :update or
    #            :identical.
    #
    # +identifier+:: The identifier of the item the action was performed on.
    def file(level, action, identifier, duration=nil)
      log(
        level,
        '%s%12s%s  %s%s' % [<commit_msg>improved win32console warning<commit_after># encoding: utf-8

require 'singleton'

module Nanoc3::CLI

  # Nanoc3::CLI::Logger is a singleton class responsible for generating
  # feedback in the terminal.
  class Logger

    ACTION_COLORS = {
      :create         => "\e[1m" + "\e[32m", # bold + green
      :update         => "\e[1m" + "\e[33m", # bold + yellow
      :identical      => "\e[1m",            # bold
      :skip           => "\e[1m"             # bold
    }

    include Singleton

    # The log level, which can be :high, :low or :off (which will log all
    # messages, only high-priority messages, or no messages at all,
    # respectively).
    attr_accessor :level

    # Whether to use color in log messages or not
    attr_accessor :color
    alias_method :color?, :color

    def initialize
      @level = :high
      @color = true

      # Try enabling color support on Windows
      begin
        require 'Win32/Console/ANSI' if RUBY_PLATFORM =~/mswin|mingw/
      rescue LoadError
        $stderr.puts 'The win32console gem is not installed. Consider installing it using "gem install win32console" to enable colored terminal output on Windows.'
        $stderr.puts
        @color = false
      end
    end

    # Logs a file-related action.
    #
    # +level+:: The importance of this action. Can be :high or :low.
    #
    # +action+:: The kind of file action. Can be :create, :update or
    #            :identical.
    #
    # +identifier+:: The identifier of the item the action was performed on.
    def file(level, action, identifier, duration=nil)
      log(
        level,
        '%s%12s%s  %s%s' % [
{'fraction_non_alphanumeric': 0.10258023914411579, 'fraction_numerical': 0.01195720578980491, 'mean_word_length': 2.1475247524752477, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '3794328', 'n_tokens_mistral': 985, 'n_tokens_neox': 947, 'n_words': 341}