1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-26 23:22:21 +01:00

Only compile protobuf dumping when very verbose logging is enabled (#2139)

This commit is contained in:
Oxan van Leeuwen
2021-08-09 22:32:06 +02:00
committed by GitHub
parent ea4a458214
commit 926bcc71ae
6 changed files with 364 additions and 1 deletions

View File

@@ -1,8 +1,13 @@
#pragma once
#include "esphome/core/component.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h"
#ifdef ESPHOME_LOG_HAS_VERY_VERBOSE
#define HAS_PROTO_MESSAGE_DUMP
#endif
namespace esphome {
namespace api {
@@ -243,8 +248,10 @@ class ProtoMessage {
public:
virtual void encode(ProtoWriteBuffer buffer) const = 0;
void decode(const uint8_t *buffer, size_t length);
#ifdef HAS_PROTO_MESSAGE_DUMP
std::string dump() const;
virtual void dump_to(std::string &out) const = 0;
#endif
protected:
virtual bool decode_varint(uint32_t field_id, ProtoVarInt value) { return false; }