Class: Pvectl::Commands::Logs::Handlers::Journal

Inherits:
Object
  • Object
show all
Includes:
ResourceHandler
Defined in:
lib/pvectl/commands/logs/handlers/journal.rb,
sig/pvectl/commands/logs/handlers/journal.rbs

Overview

Handler for node systemd journal output.

Fetches journal entries from a node via Repositories::Journal. Not registered in ResourceRegistry — created by Command when --journal flag is set.

Instance Method Summary collapse

Constructor Details

#initialize(repository: nil) ⇒ Journal

Returns a new instance of Journal.

Parameters:



19
20
21
# File 'lib/pvectl/commands/logs/handlers/journal.rb', line 19

def initialize(repository: nil)
  @repository = repository
end

Instance Method Details

#list(node:, limit: 50, since: nil, until_time: nil, **_) ⇒ Array[Models::JournalEntry]

Parameters:

  • node: (String)
  • limit: (Integer) (defaults to: 50)
  • since: (String, nil) (defaults to: nil)
  • until_time: (String, nil) (defaults to: nil)
  • (Object)

Returns:



23
24
25
26
# File 'lib/pvectl/commands/logs/handlers/journal.rb', line 23

def list(node:, limit: 50, since: nil, until_time: nil, **_)
  repository.list(node: node, last_entries: limit, since: since,
                  until_time: until_time)
end

#presenterPresenters::JournalEntry



28
29
30
# File 'lib/pvectl/commands/logs/handlers/journal.rb', line 28

def presenter
  Presenters::JournalEntry.new
end

#repositoryRepositories::Journal



34
35
36
37
38
39
40
41
# File 'lib/pvectl/commands/logs/handlers/journal.rb', line 34

def repository
  @repository ||= begin
    config_service = Pvectl::Config::Service.new
    config_service.load
    connection = Pvectl::Connection.new(config_service.current_config)
    Repositories::Journal.new(connection)
  end
end