<commit_before>require 'socket'
require 'osc-ruby'

require 'json'

require 'qcmd/version'

require 'qcmd/plaintext'
require 'qcmd/commands'
require 'qcmd/input_completer'

require 'qcmd/core_ext/array'
require 'qcmd/core_ext/osc/message'
require 'qcmd/core_ext/osc/tcp_client'

module Qcmd
  autoload :Configuration, 'qcmd/configuration'
  autoload :History, 'qcmd/history'
  autoload :Handler, 'qcmd/handler'
  autoload :Server, 'qcmd/server'
  autoload :Context, 'qcmd/context'
  autoload :Parser, 'qcmd/parser'
  autoload :CLI, 'qcmd/cli'
  autoload :Machine, 'qcmd/machine'
  autoload :Network, 'qcmd/network'
  autoload :QLab, 'qcmd/qlab'
  autoload :VERSION, 'qcmd/version'

  # on launch

  class << self
    include Qcmd::Plaintext

    attr_accessor :log_level
    attr_accessor :debug_mode
    attr_accessor :context

    def verbose!
      self.log_level = :debug
    end

    def quiet!
      self.log_level = :warning
    end

    def silent!
      self.log_level = :none
    end

    def silent?
      self.log_level == :none
    end

    def quiet?
      self.log_level == :warning
    end

    def while_quiet
      previous_level = self.log_level
      self.log_level = :warning
      yield
      self.log_level = previous_level
    end

    def debug?
      !!debug_mode
    end

    def debug message
      # always write to log
      Qcmd::Configuration.log.puts message

      log(message) if log_level == :debug
    end

    def connected?
      !!context && !!context.machine && !context.machine.nil?
    end
  end
end<commit_msg>add timestamp to log<commit_after>require 'socket'
require 'osc-ruby'

require 'json'

require 'qcmd/version'

require 'qcmd/plaintext'
require 'qcmd/commands'
require 'qcmd/input_completer'

require 'qcmd/core_ext/array'
require 'qcmd/core_ext/osc/message'
require 'qcmd/core_ext/osc/tcp_client'

module Qcmd
  autoload :Configuration, 'qcmd/configuration'
  autoload :History, 'qcmd/history'
  autoload :Handler, 'qcmd/handler'
  autoload :Server, 'qcmd/server'
  autoload :Context, 'qcmd/context'
  autoload :Parser, 'qcmd/parser'
  autoload :CLI, 'qcmd/cli'
  autoload :Machine, 'qcmd/machine'
  autoload :Network, 'qcmd/network'
  autoload :QLab, 'qcmd/qlab'
  autoload :VERSION, 'qcmd/version'

  # on launch

  class << self
    include Qcmd::Plaintext

    attr_accessor :log_level
    attr_accessor :debug_mode
    attr_accessor :context

    def verbose!
      self.log_level = :debug
    end

    def quiet!
      self.log_level = :warning
    end

    def silent!
      self.log_level = :none
    end

    def silent?
      self.log_level == :none
    end

    def quiet?
      self.log_level == :warning
    end

    def while_quiet
      previous_level = self.log_level
      self.log_level = :warning
      yield
      self.log_level = previous_level
    end

    def debug?
      !!debug_mode
    end

    def debug message
      # always write to log
      Qcmd::Configuration.log.puts "[%s] %s" % [Time.now.strftime('%T'), message]

      log(message) if log_level == :debug
    end

    def connected?
      !!context && !!context.machine && !context.machine.nil?
    end
  end
end
{'fraction_non_alphanumeric': 0.10367786937222574, 'fraction_numerical': 0.0, 'mean_word_length': 2.9339152119700747, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, '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': '2297150', 'n_tokens_mistral': 1125, 'n_tokens_neox': 1089, 'n_words': 261}