<commit_before>require "structured_logger/version"

module StructuredLogger
  # Your code goes here...
end<commit_msg>Add StructuredLogger<commit_after>require "structured_logger/version"
require "logger"

class StructuredLogger

  def initialize(name, log_device=STDOUT)
    @name = name
    @logger = ::Logger.new(STDOUT).tap do |logger|
      logger.formatter = JSONFormatter.new
    end
  end

  def event(name, options={})
    Entry.new(@name, @logger).event(name, options)
  end

  def metric(name, value, type: "counter")
    Entry.new(@name, @logger).metric(name, value, type)
  end

  def debug(message)
    Entry.new(@name, @logger).debug(message)
  end

  def info(message)
    Entry.new(@name, @logger).info(message)
  end

  def warn(message)
    Entry.new(@name, @logger).warn(message)
  end

  def error(message)
    Entry.new(@name, @logger).error(message)
  end

  def fatal(message)
    Entry.new(@name, @logger).fatal(message)
  end

end
{'fraction_non_alphanumeric': 0.13179916317991633, 'fraction_numerical': 0.0, 'mean_word_length': 4.063492063492063, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4086924', 'n_tokens_mistral': 326, 'n_tokens_neox': 310, 'n_words': 71}