AwesomeStudioPedal
A programmable, multi-profile foot controller for DAWs, score readers, and studio automation
Loading...
Searching...
No Matches
serial_logger.cpp
Go to the documentation of this file.
1#include "i_logger.h"
2
3#ifndef HOST_TEST_BUILD
4#include <Arduino.h>
5#else
6#include <iostream>
7#endif
8
16class SerialLogger : public ILogger
17{
18public:
24 void log(const char* message) override
25 {
26#ifndef HOST_TEST_BUILD
27 Serial.println(message);
28#else
29 std::cout << "DEBUG: " << message << '\n';
30#endif
31 }
32
39 void log(const char* prefix, const char* message) override
40 {
41#ifndef HOST_TEST_BUILD
42 Serial.print(prefix);
43 Serial.println(message);
44#else
45 std::cout << prefix << message << '\n';
46#endif
47 }
48};
49
56{
57 static SerialLogger instance;
58 return &instance;
59}
Interface for logging functionality.
Definition i_logger.h:11
Concrete logger implementation using serial output.
void log(const char *message) override
Logs a single message to serial output.
void log(const char *prefix, const char *message) override
Logs a message with prefix to serial output.
ILogger * createLogger()
Creates and returns a SerialLogger instance.