Sha256: 287951b5ba140f21aa6dd5ad6af9a92a11af95b8ab89cc5c8bcc9267a5f54af5

Contents?: true

Size: 886 Bytes

Versions: 2

Compression:

Stored size: 886 Bytes

Contents

require 'semlogr/logger'

module Semlogr
  @logger = nil

  def self.configure
    @logger = Logger.create do |config|
      yield(config)
    end
  end

  def self.logger
    unless @logger
      raise StandardError, 'You need to initialize the logger instance by calling Semlogr::Log.configure first!'
    end

    @logger
  end

  def self.debug(template = nil, **properties, &block)
    logger.debug(template, **properties, &block)
  end

  def self.info(template = nil, **properties, &block)
    logger.info(template, **properties, &block)
  end

  def self.warn(template = nil, **properties, &block)
    logger.warn(template, **properties, &block)
  end

  def self.error(template = nil, **properties, &block)
    logger.error(template, **properties, &block)
  end

  def self.fatal(template = nil, **properties, &block)
    logger.fatal(template, **properties, &block)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
semlogr-0.1.1 lib/semlogr.rb
semlogr-0.1.0 lib/semlogr.rb