Sha256: 5957090fa2dbb1eab3b609084a92fada75df35ce3e33136d67ddf88d98b8378b
Contents?: true
Size: 822 Bytes
Versions: 1
Compression:
Stored size: 822 Bytes
Contents
#!/usr/bin/env ruby # -*- coding: utf-8 -*- require 'djb/daemontools/multilog/logs' module Djb module Daemontools module Multilog class Collector attr_accessor :service_dir,:lines alias directory= service_dir= def initialize(dir = "/service") @lines = 100 @service_dir = dir end def collect all = Logs.new glob_pattern = @service_dir + "/*/log/main/current" Dir.glob(glob_pattern).each do |file| all += Logs.new.load(file,@lines) end all.sort! do |a,b| a.time <=> b.time end all[-@lines..-1] end end end end end =begin #collector = Djb::Daemontools::Multilog::Collector.new("/Users/tumf/service") #puts collector.collect =end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
multilog-collector-0.3.0 | lib/djb/daemontools/multilog/collector.rb |