Class: Captive::Commands::Logs

Inherits:
Object
  • Object
show all
Defined in:
lib/captive/commands/logs.rb

Overview

Affiche les logs d'une app en mode live (kubectl) ou historique (Loki via dashboard).

Instance Method Summary collapse

Constructor Details

#initialize(kubectl:, dashboard: DashboardClient.new, paint: Pastel.new) ⇒ Logs

Returns a new instance of Logs.



13
14
15
16
17
# File 'lib/captive/commands/logs.rb', line 13

def initialize(kubectl:, dashboard: DashboardClient.new, paint: Pastel.new)
  @kubectl   = kubectl
  @dashboard = dashboard
  @colorizer = Presenter::LogColorizer.new(paint: paint)
end

Instance Method Details

#run(app, follow: false, container: nil, worker: false, lines: 100, from: nil, to: nil, raw: false) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/captive/commands/logs.rb', line 19

def run(app, follow: false, container: nil, worker: false, lines: 100, from: nil, to: nil, raw: false)
  if from || to
    run_historical(app, from: from, to: to, lines: lines, raw: raw)
  else
    run_live(app, follow: follow, container: container, worker: worker, lines: lines, raw: raw)
  end
end