Module: Deployable::Log
- Defined in:
- lib/deployable/log.rb,
lib/deployable/log/version.rb
Overview
A singleton interface to the Deployable logger
Constant Summary collapse
- DefaultIO =
Default output DefaultIO = STDOUT
$stdout- VERSION =
"0.5.0"
Class Method Summary collapse
-
.create_log(io = DefaultIO, level = ::Deployable::Logger::INFO) ⇒ Object
create a new logger Doesn’t impact the singleton.
-
.included(base) ⇒ Object
Add ‘.log` to the class instance on include.
-
.log ⇒ Object
Add ‘.log` to the instance of the class Return the singleton or create it.
-
.log_level(level) ⇒ Object
Set the level for the logger.
-
.replace_log(io = DefaultIO, level = @log.level) ⇒ Object
Replace the singleton logger with a new target/level.
Instance Method Summary collapse
-
#log ⇒ Object
Adds ‘.log` method to the class instance to return the singleton.
Class Method Details
.create_log(io = DefaultIO, level = ::Deployable::Logger::INFO) ⇒ Object
create a new logger Doesn’t impact the singleton
196 197 198 199 200 |
# 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) ⇒ Object
Add ‘.log` to the class instance on include
224 225 226 227 228 229 230 |
# File 'lib/deployable/log.rb', line 224 def included base class << base def log Deployable::Log.log end end end |
.log ⇒ Object
Add ‘.log` to the instance of the class Return the singleton or create it
219 220 221 |
# File 'lib/deployable/log.rb', line 219 def log @log #||= Log.create end |
.log_level(level) ⇒ Object
Set the level for the logger
210 211 212 213 214 215 |
# 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) ⇒ Object
Replace the singleton logger with a new target/level
203 204 205 206 207 |
# 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 |
Instance Method Details
#log ⇒ Object
Adds ‘.log` method to the class instance to return the singleton
238 239 240 |
# File 'lib/deployable/log.rb', line 238 def log ::Deployable::Log.log end |