Sha256: 5fb07269f411c2053c69d2da787c81804f63b387bf7e0f60f745880fc459b082

Contents?: true

Size: 566 Bytes

Versions: 1

Compression:

Stored size: 566 Bytes

Contents

#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'djb/daemontools/multilog/log'
module Djb
  module Daemontools
    module Multilog
      class Logs < Array

        def load(file,lines = nil)
          @file = file
          open(file) do |f|
            while line = f.gets
              self << Log.new(line,service) rescue {}
            end
          end
          self
        end

        def service
          $1 if /\/([^\/]+)\/log\/main\/current/ =~ @file
        end

        def to_s
          join("\n",self)
        end

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
multilog-collector-0.3.3 lib/djb/daemontools/multilog/logs.rb