mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-03 17:59:27 +02:00
Add logging to tests
This commit is contained in:
parent
5d0486c87c
commit
8af86d9f29
2 changed files with 25 additions and 0 deletions
|
@ -7,6 +7,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "HardwareSerial.h"
|
#include "HardwareSerial.h"
|
||||||
|
#include "Logging.h"
|
||||||
#include "Print.h"
|
#include "Print.h"
|
||||||
|
|
||||||
#include "esp-hal-gpio.h"
|
#include "esp-hal-gpio.h"
|
||||||
|
|
24
test/emul/Logging.h
Normal file
24
test/emul/Logging.h
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
#ifndef LOGGING_H
|
||||||
|
#define LOGGING_H
|
||||||
|
|
||||||
|
#include <cstdarg>
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
|
class Logging {
|
||||||
|
public:
|
||||||
|
static void printf(const char* format, ...) {
|
||||||
|
va_list args;
|
||||||
|
va_start(args, format);
|
||||||
|
vprintf(format, args);
|
||||||
|
va_end(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void println(const char* message) { printf("%s\n", message); }
|
||||||
|
|
||||||
|
static void print(const char* message) { printf("%s", message); }
|
||||||
|
};
|
||||||
|
|
||||||
|
// Global logging instance
|
||||||
|
extern Logging logging;
|
||||||
|
|
||||||
|
#endif
|
Loading…
Add table
Add a link
Reference in a new issue