feat: add logging system and debug audio routing
Co-authored-by: aider (deepseek/deepseek-coder) <aider@aider.chat>
This commit is contained in:
36
logging.h
36
logging.h
@@ -0,0 +1,36 @@
|
||||
#ifndef LOGGING_H
|
||||
#define LOGGING_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include <time.h>
|
||||
|
||||
// Log levels
|
||||
typedef enum {
|
||||
LOG_LEVEL_ERROR,
|
||||
LOG_LEVEL_WARN,
|
||||
LOG_LEVEL_INFO,
|
||||
LOG_LEVEL_DEBUG,
|
||||
LOG_LEVEL_TRACE
|
||||
} LogLevel;
|
||||
|
||||
// Initialize logging system
|
||||
void log_init(const char *filename, LogLevel level);
|
||||
|
||||
// Cleanup logging system
|
||||
void log_cleanup(void);
|
||||
|
||||
// Set minimum log level
|
||||
void log_set_level(LogLevel level);
|
||||
|
||||
// Log a message
|
||||
void log_message(LogLevel level, const char *file, int line, const char *func, const char *format, ...);
|
||||
|
||||
// Convenience macros
|
||||
#define LOG_ERROR(...) log_message(LOG_LEVEL_ERROR, __FILE__, __LINE__, __func__, __VA_ARGS__)
|
||||
#define LOG_WARN(...) log_message(LOG_LEVEL_WARN, __FILE__, __LINE__, __func__, __VA_ARGS__)
|
||||
#define LOG_INFO(...) log_message(LOG_LEVEL_INFO, __FILE__, __LINE__, __func__, __VA_ARGS__)
|
||||
#define LOG_DEBUG(...) log_message(LOG_LEVEL_DEBUG, __FILE__, __LINE__, __func__, __VA_ARGS__)
|
||||
#define LOG_TRACE(...) log_message(LOG_LEVEL_TRACE, __FILE__, __LINE__, __func__, __VA_ARGS__)
|
||||
|
||||
#endif // LOGGING_H
|
||||
|
||||
Reference in New Issue
Block a user