Class: Moneta::Logger

Inherits:
Wrapper show all
Defined in:
lib/moneta/logger.rb

Overview

Logger proxy

Defined Under Namespace

Classes: Format

Instance Attribute Summary

Attributes inherited from Proxy

#adapter

Instance Method Summary collapse

Methods inherited from Wrapper

#clear, #create, #delete, #each_key, #features, #fetch_values, #increment, #key?, #load, #merge!, #slice, #store, #values_at

Methods inherited from Proxy

#clear, #create, #delete, #each_key, #features, features_mask, #fetch_values, #increment, #key?, #load, #merge!, not_supports, #slice, #store, #values_at

Methods included from Defaults

#[], #[]=, #create, #decrement, #each_key, #features, #fetch, #fetch_values, included, #increment, #key?, #merge!, #slice, #supports?, #values_at

Methods included from OptionSupport

#expires, #prefix, #raw, #with

Constructor Details

#initialize(adapter, options = {}) ⇒ Logger

Returns a new instance of Logger

Parameters:

  • adapter (Moneta store)

    The underlying store

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :logger (Object) — default: Moneta::Logger::Format

    Logger object

  • :prefix (String) — default: 'Moneta '

    Prefix string

  • :file (File)

    Log file

  • :out (IO) — default: STDOUT

    Output


52
53
54
55
# File 'lib/moneta/logger.rb', line 52

def initialize(adapter, options = {})
  super
  @logger = options[:logger] || Format.new(options)
end

Instance Method Details

#closeObject


57
58
59
60
61
# File 'lib/moneta/logger.rb', line 57

def close
  super
  @logger.close
  nil
end