Module: Pidly::Logger

Included in:
Control
Defined in:
lib/pidly/logger.rb

Overview

Logger namespace

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#verbosityObject

Returns the value of attribute verbosity.



7
8
9
# File 'lib/pidly/logger.rb', line 7

def verbosity
  @verbosity
end

Class Method Details

.included(receiver) ⇒ Object

Extend and include callback methods

Parameters:

  • receiver (Class)

    The calling class



43
44
45
# File 'lib/pidly/logger.rb', line 43

def self.included(receiver)
  receiver.extend self
end

Instance Method Details

#log(type, message) ⇒ Strign

Log

Parameters:

  • type (String, Symbol)

    Log type (info or error)

  • message (String)

    Log message

Returns:

  • (Strign)

    Log message



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/pidly/logger.rb', line 26

def log(type, message)
  case type.to_sym
  when :info
    msg = message
  when :error
    msg = message
  end

  @messages << msg
  puts msg if verbose?
end

#verbose?true, false

Verbose

Returns:

  • (true, false)

    Is the logging level verbose?



14
15
16
# File 'lib/pidly/logger.rb', line 14

def verbose?
  @verbosity
end