Module: RUPNP::LogMixin

Included in:
CP::Base, CP::EventServer, ControlPoint, SSDP::MulticastConnection
Defined in:
lib/rupnp/log_mixin.rb

Overview

Mixin to add log facility to others classes.

Author:

  • Sylvain Daubert

Constant Summary collapse

LOG_LEVEL =

Log severity levels

{
  :failure => 5,
  :error   => 4,
  :warn    => 3,
  :info    => 2,
  :debug   => 1
}

Instance Method Summary collapse

Instance Method Details

#log(level, msg = '') ⇒ Object

log a message

Parameters:

  • level (Symbol)

    severity level. May be :debug, :info, warn, or :error

  • msg (String) (defaults to: '')

    message to log



22
23
24
25
26
# File 'lib/rupnp/log_mixin.rb', line 22

def log(level, msg='')
  if LOG_LEVEL[level] >= LOG_LEVEL[RUPNP.log_level]
    RUPNP.logdev.puts "[#{level}] #{msg}"
  end
end