module Deployable::Log

A singleton interface to the Deployable logger

Constants

DefaultIO
Default output

DefaultIO = STDOUT

VERSION

Public Class Methods

create_log(io = DefaultIO, level = ::Deployable::Logger::INFO) click to toggle source

create a new logger Doesn’t impact the singleton

# File lib/deployable/log.rb, line 196
def create_log io = DefaultIO, level = ::Deployable::Logger::INFO
  l = ::Deployable::Logger.new io
  l.level = level
  l
end
included(base) click to toggle source

Add ‘.log` to the class instance on include

# File lib/deployable/log.rb, line 224
def included base
  class << base
    def log
      Deployable::Log.log
    end
  end
end
log() click to toggle source

Add ‘.log` to the instance of the class Return the singleton or create it

# File lib/deployable/log.rb, line 219
def log 
  @log #||= Log.create
end
log_level(level) click to toggle source

Set the level for the logger

# File lib/deployable/log.rb, line 210
def log_level level
  level = Deployable::Logger.const_get level.upcase unless 
    level.kind_of? ::Fixnum

  @log.level = level
end
replace_log(io = DefaultIO, level = @log.level) click to toggle source

Replace the singleton logger with a new target/level

# File lib/deployable/log.rb, line 203
def replace_log io = DefaultIO, level = @log.level
  l = ::Deployable::Logger.new io, level
  #l.level = @log.level
  @log = l
end

Public Instance Methods

log() click to toggle source

Adds ‘.log` method to the class instance to return the singleton

# File lib/deployable/log.rb, line 238
def log
  ::Deployable::Log.log
end