mirror of
https://github.com/esphome/esphome.git
synced 2026-10-07 03:16:37 +00:00
[logger] Replace std::function callbacks with LogListener interface (#12153)
This commit is contained in:
@@ -7,6 +7,9 @@
|
||||
#include "esphome/core/component.h"
|
||||
#include "esphome/core/controller.h"
|
||||
#include "esphome/core/entity_base.h"
|
||||
#ifdef USE_LOGGER
|
||||
#include "esphome/components/logger/logger.h"
|
||||
#endif
|
||||
|
||||
#include <functional>
|
||||
#include <list>
|
||||
@@ -170,7 +173,14 @@ class DeferredUpdateEventSourceList : public std::list<DeferredUpdateEventSource
|
||||
* under the '/light/...', '/sensor/...', ... URLs. A full documentation for this API
|
||||
* can be found under https://esphome.io/web-api/index.html.
|
||||
*/
|
||||
class WebServer : public Controller, public Component, public AsyncWebHandler {
|
||||
class WebServer : public Controller,
|
||||
public Component,
|
||||
public AsyncWebHandler
|
||||
#ifdef USE_LOGGER
|
||||
,
|
||||
public logger::LogListener
|
||||
#endif
|
||||
{
|
||||
#if !defined(USE_ESP32) && defined(USE_ARDUINO)
|
||||
friend class DeferredUpdateEventSourceList;
|
||||
#endif
|
||||
@@ -230,6 +240,10 @@ class WebServer : public Controller, public Component, public AsyncWebHandler {
|
||||
|
||||
void dump_config() override;
|
||||
|
||||
#ifdef USE_LOGGER
|
||||
void on_log(uint8_t level, const char *tag, const char *message, size_t message_len) override;
|
||||
#endif
|
||||
|
||||
/// MQTT setup priority.
|
||||
float get_setup_priority() const override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user