Sha256: 2b91818e0928b0ccb681a6e7b6f22386fc3f873efc822f1a600db4f05b961526

Contents?: true

Size: 1.24 KB

Versions: 5

Compression:

Stored size: 1.24 KB

Contents

# Author::    Nicolas Despres  <nicolas.despres@gmail.com>.
# Copyright:: Copyright (c) 2004, 2005 TTK team. All rights reserved.
# License::   LGPL
# $Id: logger.rb 567 2005-04-13 08:00:06Z polrop $


require 'dlogger' #FIXME: remove me ASAP


module TTK

  module Daemons

    class Daemon

      class Logger < DLogger

        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

        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

      end # class Logger

    end # class Daemon

  end # module Daemons

end # module TTK



Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ttk-0.1.576 lib/ttk/daemons/daemon/logger.rb
ttk-0.1.579 lib/ttk/daemons/daemon/logger.rb
ttk-0.2.1 lib/ttk/daemons/daemon/logger.rb
ttk-0.1.580 lib/ttk/daemons/daemon/logger.rb
ttk-0.2.0 lib/ttk/daemons/daemon/logger.rb