Implement macros that capture current file, line, and function name.

This commit is contained in:
2024-06-13 13:48:20 -04:00
parent 4106bdb662
commit 7ab579fa0b
3 changed files with 87 additions and 14 deletions

View File

@@ -47,7 +47,6 @@ namespace jlog
void log(std::vector<token> tokens);
void direct (const std::string& message);
void info (const std::string& message);
void verbose(const std::string& message);
@@ -59,4 +58,21 @@ namespace jlog
void fatal (const std::string& message);
}
void info_spec(const std::string& message, const std::string& func, const std::string& file, int line);
void verbose_spec(const std::string& message, const std::string& func, const std::string& file, int line);
void debug_spec(const std::string& message, const std::string& func, const std::string& file, int line);
void warning_spec(const std::string& message, const std::string& func, const std::string& file, int line);
void error_spec(const std::string& message, const std::string& func, const std::string& file, int line);
void fatal_spec(const std::string& message, const std::string& func, const std::string& file, int line);
}
#define INFO(i) jlog::info_spec(i, __PRETTY_FUNCTION__, __FILE__, __LINE__);
#define VERBOSE(i) jlog::verbose_spec(i, __PRETTY_FUNCTION__, __FILE__, __LINE__);
#define DEBUG(i) jlog::debug_spec(i, __PRETTY_FUNCTION__, __FILE__, __LINE__);
#define WARNING(i) jlog::warning_spec(i, __PRETTY_FUNCTION__, __FILE__, __LINE__);
#define ERROR(i) jlog::error_spec(i, __PRETTY_FUNCTION__, __FILE__, __LINE__);
#define FATAL(i) jlog::fatal_spec(i, __PRETTY_FUNCTION__, __FILE__, __LINE__);