Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Ing-Dom committed Dec 29, 2023
1 parent 7d0a454 commit 983a2ff
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/knx/logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@

void KnxLogger::log(const char* message, va_list& values)
{
if(_callback)
{
_callback(message, values);
return;
}
printf(message, values);
}

void KnxLogger::setCallback(KnxLoggerCallback callback)
{
_callback = callback;
}

KnxLogger knxLogger;
4 changes: 4 additions & 0 deletions src/knx/logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@

#include "platform.h"

typedef void (*KnxLoggerCallback)(const char* message, va_list& values);

class KnxLogger
{
protected:
KnxLoggerCallback _callback = nullptr;
public:
void log(const char* message, va_list& values);
void setCallback(KnxLoggerCallback callback);
};

extern KnxLogger knxLogger;
Expand Down

0 comments on commit 983a2ff

Please sign in to comment.