esphome-api-client 0.5.0
Modern C++17 client for the ESPHome native API (plaintext + Noise)
Loading...
Searching...
No Matches
log_stream.hpp
Go to the documentation of this file.
1#pragma once
2
5
8
9#include <functional>
10#include <string>
11
12namespace esphome::api {
13
15struct LogEntry {
17 std::string message;
18};
19
21class LogStream : public Subsystem {
22public:
23 using Handler = std::function<void(const LogEntry&)>;
24
25 explicit LogStream(Client& client) : Subsystem(client) {}
26
29 void subscribe(LogLevel level, Handler handler, bool dump_config = false);
30
31private:
32 Handler handler_;
33};
34
35} // namespace esphome::api
Async client for a single device.
Definition client.hpp:38
Subscribes to and surfaces the device's log stream.
Definition log_stream.hpp:21
std::function< void(const LogEntry &)> Handler
Definition log_stream.hpp:23
void subscribe(LogLevel level, Handler handler, bool dump_config=false)
Begin streaming logs at level or more severe.
LogStream(Client &client)
Definition log_stream.hpp:25
Shared base for the subsystems exposed by Client (log streaming, the various proxies,...
Definition subsystem.hpp:18
Typed mirrors of the ESPHome protobuf enums.
Definition bytes.hpp:10
LogLevel
Mirror of proto enum LogLevel.
Definition enums.hpp:91
A single log line streamed from the device.
Definition log_stream.hpp:15
std::string message
Definition log_stream.hpp:17
LogLevel level
Definition log_stream.hpp:16
Common base for the Client-owned subsystems.