-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit e1647cc Author: Boris Brock <[email protected]> Date: Sat Oct 5 07:29:17 2024 +0200 Correction commit bab7861 Author: Boris Brock <[email protected]> Date: Sat Oct 5 07:26:30 2024 +0200 Improving startup info commit 817ccbb Author: Boris Brock <[email protected]> Date: Sat Oct 5 07:13:40 2024 +0200 Introducing custom logger commit b1a43d0 Author: Boris Brock <[email protected]> Date: Sat Oct 5 06:26:32 2024 +0200 Fixing main info block commit 948ec6f Author: Boris Brock <[email protected]> Date: Sat Oct 5 06:20:54 2024 +0200 Update ModbusRTU.cpp commit e5dfcea Author: Boris Brock <[email protected]> Date: Sat Oct 5 06:16:32 2024 +0200 Logging additions commit 055fa24 Author: Boris Brock <[email protected]> Date: Sat Oct 5 05:47:10 2024 +0200 Integrating DebugLog
- Loading branch information
1 parent
c33dc2d
commit 7c0e007
Showing
10 changed files
with
185 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include <Arduino.h> | ||
#include "Logger.h" | ||
|
||
namespace Logger | ||
{ | ||
const char *GetLogLevel() | ||
{ | ||
#ifdef LOGGING_LEVEL_ERROR | ||
return "Error"; | ||
#elif defined(LOGGING_LEVEL_WARNING) | ||
return "Warning"; | ||
#elif defined(LOGGING_LEVEL_INFO) | ||
return "Info"; | ||
#elif defined(LOGGING_LEVEL_DEBUG) | ||
return "Debug"; | ||
#elif defined(LOGGING_LEVEL_TRACE) | ||
return "Trace"; | ||
#else | ||
return "Undefined"; | ||
#endif | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#pragma once | ||
|
||
namespace Logger | ||
{ | ||
template <typename... Args> | ||
void Error(const char *format, Args... args) | ||
{ | ||
#if defined(LOGGING_LEVEL_ERROR) || defined(LOGGING_LEVEL_WARNING) || defined(LOGGING_LEVEL_INFO) || defined(LOGGING_LEVEL_DEBUG) || defined(LOGGING_LEVEL_TRACE) | ||
Serial.print("[ERROR] "); | ||
Serial.printf(format, args...); | ||
Serial.print("\n"); | ||
#endif | ||
} | ||
|
||
template <typename... Args> | ||
void Warning(const char *format, Args... args) | ||
{ | ||
#if defined(LOGGING_LEVEL_WARNING) || defined(LOGGING_LEVEL_INFO) || defined(LOGGING_LEVEL_DEBUG) || defined(LOGGING_LEVEL_TRACE) | ||
Serial.print("[WARNING] "); | ||
Serial.printf(format, args...); | ||
Serial.print("\n"); | ||
#endif | ||
} | ||
|
||
template <typename... Args> | ||
void Info(const char *format, Args... args) | ||
{ | ||
#if defined(LOGGING_LEVEL_INFO) || defined(LOGGING_LEVEL_DEBUG) || defined(LOGGING_LEVEL_TRACE) | ||
Serial.print("[INFO] "); | ||
Serial.printf(format, args...); | ||
Serial.print("\n"); | ||
#endif | ||
} | ||
|
||
template <typename... Args> | ||
void Debug(const char *format, Args... args) | ||
{ | ||
#if defined(LOGGING_LEVEL_DEBUG) || defined(LOGGING_LEVEL_TRACE) | ||
Serial.print("[DEBUG] "); | ||
Serial.printf(format, args...); | ||
Serial.print("\n"); | ||
#endif | ||
} | ||
|
||
template <typename... Args> | ||
void Trace(const char *format, Args... args) | ||
{ | ||
#if defined(LOGGING_LEVEL_TRACE) | ||
Serial.print("[TRACE] "); | ||
Serial.printf(format, args...); | ||
Serial.print("\n"); | ||
#endif | ||
} | ||
|
||
template <typename... Args> | ||
void Print(const char *format, Args... args) | ||
{ | ||
Serial.printf(format, args...); | ||
Serial.print("\n"); | ||
} | ||
|
||
const char *GetLogLevel(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.