Class: TTK::Daemons::Daemon::Logger

Inherits:
DLogger
  • Object
show all
Defined in:
lib/ttk/daemons/daemon/logger.rb

Instance Method Summary collapse

Instance Method Details

#pp_info(msg_type, *infos) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/ttk/daemons/daemon/logger.rb', line 33

def pp_info(msg_type, *infos)
  case msg_type
  when :daemon_notification_start
    "start"
  when :daemon_notification_stop
    "stop"
  when :daemon_notification_workdir
    "workdir: `#{infos[0]}'"
  when :daemon_notification_config
    str = "config:\n"
    str += infos.inspect
    str
  end
end

#update(*args, &block) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/ttk/daemons/daemon/logger.rb', line 18

def update(*args, &block)
  observable, msg_type, *infos = args
  msg = "#{observable}: "
  if (info_msg = pp_info(msg_type, *infos)).nil?
    msg += "#{msg_type}"
    unless infos.empty?
      msg += "\n"
      msg += infos.inspect
    end
  else
    msg += "#{info_msg}"
  end
  add(INFO, msg.chomp, $PROGRAME_NAME)
end