Class: Tidewave::Tools::GetLogs

Inherits:
Base
  • Object
show all
Defined in:
lib/tidewave/tools/get_logs.rb

Instance Method Summary collapse

Methods inherited from Base

file_system_tool, file_system_tool?

Instance Method Details

#call(tail:) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/tidewave/tools/get_logs.rb', line 15

def call(tail:)
  log_file = Rails.root.join("log", "#{Rails.env}.log")
  return "Log file not found" unless File.exist?(log_file)

  logs = File.readlines(log_file).last(tail)
  logs.join
end