Module: CardanoUp::Tail

Defined in:
lib/cardano-up/tail.rb

Overview

Tail log file

Class Method Summary collapse

Class Method Details

.tail(file_path, lines = nil) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/cardano-up/tail.rb', line 6

def self.tail(file_path, lines = nil)
  lines_back = lines || 10
  File.open(file_path) do |log|
    log.extend(File::Tail)
    log.interval
    log.backward(lines_back.to_i)
    log.tail { |line| warn line }
  end
end