module Berkshelf::API::Logging

Attributes

logger[RW]

@return [Logger]

Public Class Methods

init(options = {}) click to toggle source

@option options [String, Fixnum] :location (STDOUT) @option options [String, nil] :level (“INFO”)

- "DEBUG
- "INFO"
- "WARN"
- "ERROR"
- "FATAL"

@option options [Logger::Formatter] :formatter

@return [Logger]

# File lib/berkshelf/api/logging.rb, line 17
def init(options = {})
  level     = options[:level] || "INFO"
  location  = options[:location] || STDOUT
  formatter = options[:formatter] || nil

  Celluloid.logger = @logger = Logger.new(location).tap do |log|
    log.level     = Logger::Severity.const_get(level.upcase)
    log.formatter = formatter if formatter
  end
end

Public Instance Methods

log()
Alias for: logger
logger() click to toggle source

@return [Logger]

# File lib/berkshelf/api/logging.rb, line 32
def logger
  Logging.logger
end
Also aliased as: log