Sha256: 997548fa545eaa8d19d869a794f2e72a0ad9f3151ffad96742e3206d69f5c85a

Contents?: true

Size: 1004 Bytes

Versions: 2

Compression:

Stored size: 1004 Bytes

Contents

require "filum/version"
require "filum/filum_error"
require "filum/configuration"
require "filum/log_formatter"
require "filum/logger"

module Filum

  # Filum configuration settings.
  #
  # Settings should be set in an initializer or using some
  # other method that insures they are set before any
  # Filum code is used. They can be set as followed:
  #
  #   Filum.config.logfile = "/var/log/mylogfile.log"
  #
  # The following settings are allowed:
  #
  # * <tt>:logfile</tt> - The logfile
  def self.config
    @config ||= Configuration.new
    if block_given?
      yield @config
    else
      @config
    end
  end

  # Filum logger.
  #
  # Logger. Log in the following way:
  #
  #   Filum.logger.info "Log this"
  #
  def self.logger
    logfile = Filum.config.logfile
    dir = File.dirname(logfile)
    unless File.directory?(dir)
      FileUtils.mkdir_p(dir)
    end

    @logger ||= Filum::Logger.new(logfile, shift_age='daily')
    @logger.level = Logger::INFO
    @logger
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
filum-1.0.3 lib/filum.rb
filum-1.0.2 lib/filum.rb