Complete Rebuild, with Subsystems for each component. RTOS Tasks. (help by Claude)
This commit is contained in:
65
vesper/src/Logging/Logging.hpp
Normal file
65
vesper/src/Logging/Logging.hpp
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* ═══════════════════════════════════════════════════════════════════════════════════
|
||||
* LOGGING.HPP - Centralized Logging System
|
||||
* ═══════════════════════════════════════════════════════════════════════════════════
|
||||
*
|
||||
* 📝 THE INFORMATION CHRONICLER OF VESPER 📝
|
||||
*
|
||||
* This header provides a unified logging interface with multiple levels,
|
||||
* timestamps, and comprehensive debugging support throughout the system.
|
||||
*
|
||||
* 📋 VERSION: 2.0 (Enhanced logging system)
|
||||
* 📅 DATE: 2025
|
||||
* 👨💻 AUTHOR: Advanced Bell Systems
|
||||
* ═══════════════════════════════════════════════════════════════════════════════════
|
||||
*/
|
||||
|
||||
#ifndef LOGGING_HPP
|
||||
#define LOGGING_HPP
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
class Logging {
|
||||
public:
|
||||
// Log Levels
|
||||
enum LogLevel {
|
||||
NONE = 0, // No logs
|
||||
ERROR = 1, // Errors only
|
||||
WARNING = 2, // Warnings and errors
|
||||
INFO = 3, // Info, warnings, and errors
|
||||
DEBUG = 4, // Debug logs. Really high level (full debugging)
|
||||
VERBOSE = 5 // Nearly every command gets printed
|
||||
};
|
||||
|
||||
private:
|
||||
static LogLevel currentLevel;
|
||||
|
||||
public:
|
||||
// Set the active log level
|
||||
static void setLevel(LogLevel level);
|
||||
|
||||
// Get current log level
|
||||
static LogLevel getLevel();
|
||||
|
||||
// Logging functions
|
||||
static void error(const char* format, ...);
|
||||
static void warning(const char* format, ...);
|
||||
static void info(const char* format, ...);
|
||||
static void debug(const char* format, ...);
|
||||
static void verbose(const char* format, ...);
|
||||
|
||||
// Check if level is enabled (for conditional logging)
|
||||
static bool isLevelEnabled(LogLevel level);
|
||||
|
||||
private:
|
||||
static void log(LogLevel level, const char* levelStr, const char* format, va_list args);
|
||||
};
|
||||
|
||||
// Convenience macros for easier use
|
||||
#define LOG_ERROR(...) Logging::error(__VA_ARGS__)
|
||||
#define LOG_WARNING(...) Logging::warning(__VA_ARGS__)
|
||||
#define LOG_INFO(...) Logging::info(__VA_ARGS__)
|
||||
#define LOG_DEBUG(...) Logging::debug(__VA_ARGS__)
|
||||
#define LOG_VERBOSE(...) Logging::verbose(__VA_ARGS__)
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user