Module: HAP::Log

Included in:
Client
Defined in:
lib/hap_client/log.rb

Constant Summary collapse

LOG_LVL =
ENV['DEBUG'] ? :debug : :info

Instance Method Summary collapse

Instance Method Details

#debug(msg) ⇒ Object



32
33
34
# File 'lib/hap_client/log.rb', line 32

def debug(msg)
  @log.debug(msg)
end

#error(msg) ⇒ Object



20
21
22
# File 'lib/hap_client/log.rb', line 20

def error(msg)
  @log.error(msg)
end

#fatal(msg) ⇒ Object



16
17
18
# File 'lib/hap_client/log.rb', line 16

def fatal(msg)
  @log.fatal(msg)
end

#info(msg) ⇒ Object



28
29
30
# File 'lib/hap_client/log.rb', line 28

def info(msg)
  @log.info(msg)
end

#init_logObject



7
8
9
10
11
12
13
14
# File 'lib/hap_client/log.rb', line 7

def init_log()
  @log = Logger.new(STDOUT,
                    level: LOG_LVL,
                    progname: self,
                    formatter: proc {|severity, datetime, progname, msg|
                      "[#{datetime}][#{progname}] #{severity}: #{msg}\n"
                    })
end

#log_debug?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/hap_client/log.rb', line 36

def log_debug?
  @log.debug?
end

#warn(msg) ⇒ Object



24
25
26
# File 'lib/hap_client/log.rb', line 24

def warn(msg)
  @log.warn(msg)
end