Module: Logging

Included in:
TogglV8::Connection
Defined in:
lib/logging.rb

Overview

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object

Addition



17
18
19
20
21
22
23
# File 'lib/logging.rb', line 17

def self.included(base)
  class << base
    def logger
      Logging.logger
    end
  end
end

.loggerObject



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

def logger
  @logger ||= Logger.new($stdout)
end

.logger=(logger) ⇒ Object



11
12
13
# File 'lib/logging.rb', line 11

def logger=(logger)
  @logger = logger
end

Instance Method Details

#debug(debug = true) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/logging.rb', line 29

def debug(debug=true)
  if debug
    logger.level = Logger::DEBUG
  else
    logger.level = Logger::WARN
  end
end

#loggerObject



25
26
27
# File 'lib/logging.rb', line 25

def logger
  Logging.logger
end