def start(config,protocol = AnaloggerProtocol)
@config = config
daemonize if @config[-"daemonize"]
File.open(@config[-"pidfile"],-"w+") {|fh| fh.puts $$} if @config[-"pidfile"]
@logs = Hash.new {|h,k| h[k] = new_log(k)}
@queue = Hash.new {|h,k| h[k] = []}
postprocess_config_load
check_config_settings
populate_logs
set_config_defaults
@rcount = 0
@wcount = 0
@server = nil
safe_trap(EXIT_SIGNALS) {handle_pending_and_exit}
safe_trap(RELOAD_SIGNALS) {cleanup_and_reopen}
safe_trap(RESTART_SIGNALS) {exec(*EXEC_ARGUMENTS)}
EventMachine.epoll rescue nil
EventMachine.kqueue rescue nil
EventMachine.set_descriptor_table_size(4096)
EventMachine.run {
EventMachine.add_shutdown_hook do
write_queue
flush_queue
cleanup
end
@server = EventMachine.start_server @config[-"host"], @config[-"port"], protocol
EventMachine.add_periodic_timer(1) {Analogger.update_now}
EventMachine.add_periodic_timer(@config[-"interval"]) {write_queue}
EventMachine.add_periodic_timer(@config[-"syncinterval"]) {flush_queue}
}
exit
end