Sha256: 37862889a19efd021348b90d66d69e4f80c2d94e46914d1c8846caf4d6be341c

Contents?: true

Size: 952 Bytes

Versions: 1

Compression:

Stored size: 952 Bytes

Contents

# namespace
module TeeLogger
  # configuration
  module Configration
    Configration = Struct.new(:logdev)

    # Yields the global configuration to a block.
    # @yield [Configuration] global configuration
    def configure
      yield configuration if block_given?
    end

    # reset configuration
    def configuration_reset
      @configuration = nil
    end

    # set TeeLogger::Configuration::Configration's member :logdev.
    # extend or include TeeLogger then, :logdev is default argument
    # for Logger.new(logdev).
    # @param logdev [String, File]
    def logdev=(logdev)
      configuration.logdev = logdev
    end

    extend Gem::Deprecate
    deprecate :logdev=, 'TeeLogger.configure', 2016, 1

    # @return [String, File] `configuration.logdev` or `DEFAULT_FILE`.
    def logdev
      configuration.logdev || DEFAULT_FILE
    end

    private

    def configuration
      @configuration ||= Configration.new
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tee_logger-3.2.1 lib/tee_logger/configuration.rb