Skip to content

Commit

Permalink
fix(log): set default message max size locally
Browse files Browse the repository at this point in the history
  • Loading branch information
becem-gharbi committed May 23, 2024
1 parent 1d9a41a commit b34f214
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 0 additions & 2 deletions include/ESPAdmin.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
#include "MQTT.h"
#include "types.h"

#define DEFAULT_INT(x, y) (x == 0 ? y : x)

namespace ESPAdmin
{
void begin(InitOptions options);
Expand Down
2 changes: 2 additions & 0 deletions include/Store.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include "Logger.h"
#include "Store.h"

#define DEFAULT_INT(x, y) (x == 0 ? y : x)

namespace ESPAdmin
{
class NVS;
Expand Down
8 changes: 4 additions & 4 deletions src/Logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace ESPAdmin
va_list args;
va_start(args, format);

char buffer[Store::options.logMaxMessageSize];
char buffer[DEFAULT_INT(Store::options.logMaxMessageSize, 200)];
vsnprintf(buffer, sizeof(buffer), format, args);

va_end(args);
Expand All @@ -23,7 +23,7 @@ namespace ESPAdmin
va_list args;
va_start(args, format);

char buffer[Store::options.logMaxMessageSize];
char buffer[DEFAULT_INT(Store::options.logMaxMessageSize, 200)];
vsnprintf(buffer, sizeof(buffer), format, args);

va_end(args);
Expand All @@ -35,7 +35,7 @@ namespace ESPAdmin
va_list args;
va_start(args, format);

char buffer[Store::options.logMaxMessageSize];
char buffer[DEFAULT_INT(Store::options.logMaxMessageSize, 200)];
vsnprintf(buffer, sizeof(buffer), format, args);

va_end(args);
Expand All @@ -47,7 +47,7 @@ namespace ESPAdmin
va_list args;
va_start(args, format);

char buffer[Store::options.logMaxMessageSize];
char buffer[DEFAULT_INT(Store::options.logMaxMessageSize, 200)];
vsnprintf(buffer, sizeof(buffer), format, args);

va_end(args);
Expand Down

0 comments on commit b34f214

Please sign in to comment.