Class: Pvectl::Commands::Logs::Handlers::Journal
- Inherits:
-
Object
- Object
- Pvectl::Commands::Logs::Handlers::Journal
- 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
-
#initialize(repository: nil) ⇒ Journal
constructor
A new instance of Journal.
- #list(node:, limit: 50, since: nil, until_time: nil, **_) ⇒ Array[Models::JournalEntry]
- #presenter ⇒ Presenters::JournalEntry
- #repository ⇒ Repositories::Journal
Constructor Details
#initialize(repository: nil) ⇒ Journal
Returns a new instance of Journal.
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]
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 |
#presenter ⇒ Presenters::JournalEntry
28 29 30 |
# File 'lib/pvectl/commands/logs/handlers/journal.rb', line 28 def presenter Presenters::JournalEntry.new end |
#repository ⇒ Repositories::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 |