Compare commits
6 Commits
Prerelease
...
Prerelease
Author | SHA1 | Date | |
---|---|---|---|
|
f22b869335 | ||
8df5a62597 | |||
cd756f7e61 | |||
24de473770 | |||
17bd6b17ff | |||
7ab579fa0b |
@@ -42,5 +42,7 @@ install(FILES ${jlog_HEADERS} DESTINATION include/${PROJECT_NAME})
|
|||||||
|
|
||||||
#add_subdirectory(tests)
|
#add_subdirectory(tests)
|
||||||
|
|
||||||
|
target_link_libraries(jlog PUBLIC Event)
|
||||||
|
|
||||||
add_executable(LoggerDemo main.cpp)
|
add_executable(LoggerDemo main.cpp)
|
||||||
target_link_libraries(LoggerDemo ${PROJECT_NAME} Event)
|
target_link_libraries(LoggerDemo PUBLIC ${PROJECT_NAME})
|
||||||
|
18
README.md
18
README.md
@@ -19,13 +19,13 @@ Include this repository as a CPM dependency, and link against the library.
|
|||||||
|
|
||||||
```cmake
|
```cmake
|
||||||
CPMAddPackage(
|
CPMAddPackage(
|
||||||
NAME Event
|
NAME jlog
|
||||||
URL https://git.redacted.cc/josh/Event/archive/Release-6.zip
|
URL https://git.redacted.cc/josh/jlog/archive/Prerelease-2.zip
|
||||||
)
|
)
|
||||||
# ...
|
# ...
|
||||||
include_directories(${jlog_SOURCE_DIR}/include)
|
include_directories(${jlog_SOURCE_DIR}/include)
|
||||||
# ...
|
# ...
|
||||||
target_link_libraries(YourProgram ${PROJECT_NAME} jlog)
|
target_link_libraries(YourProgram ... jlog)
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -37,14 +37,22 @@ Using jlog is straightforward:
|
|||||||
#include <jlog.h>
|
#include <jlog.h>
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
jlog::info("This is barely useful information.");
|
INFO("This is barely useful information.");
|
||||||
jlog::error("Oops, something went wrong.");
|
DEBUG("Debugging Information");
|
||||||
|
VERBOSE("Yadda Yadda Yadda");
|
||||||
|
WARNING("Slight miscalculation!");
|
||||||
|
ERROR("Oops, something went wrong.");
|
||||||
|
FATAL("Unrecoverable Error!!!");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Output
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
* Custom Contexts: Allow users to specify custom logging contexts for better organization.
|
* Custom Contexts: Allow users to specify custom logging contexts for better organization.
|
||||||
|
@@ -47,16 +47,93 @@ namespace jlog
|
|||||||
|
|
||||||
void log(std::vector<token> tokens);
|
void log(std::vector<token> tokens);
|
||||||
|
|
||||||
void direct (const std::string& message);
|
|
||||||
void info (const std::string& message);
|
void info (const std::string& message);
|
||||||
|
void sinfo (const std::string& message);
|
||||||
|
void usinfo (const std::string& message);
|
||||||
|
|
||||||
|
|
||||||
void verbose(const std::string& message);
|
void verbose(const std::string& message);
|
||||||
|
void sverbose(const std::string& message);
|
||||||
|
void usverbose(const std::string& message);
|
||||||
|
|
||||||
|
|
||||||
void debug (const std::string& message);
|
void debug (const std::string& message);
|
||||||
|
void sdebug (const std::string& message);
|
||||||
|
void usdebug (const std::string& message);
|
||||||
|
|
||||||
|
|
||||||
void warning(const std::string& message);
|
void warning(const std::string& message);
|
||||||
|
void swarning(const std::string& message);
|
||||||
|
void uswarning(const std::string& message);
|
||||||
|
|
||||||
|
|
||||||
void error (const std::string& message);
|
void error (const std::string& message);
|
||||||
|
void serror (const std::string& message);
|
||||||
|
void userror (const std::string& message);
|
||||||
|
|
||||||
|
|
||||||
void fatal (const std::string& message);
|
void fatal (const std::string& message);
|
||||||
|
void sfatal (const std::string& message);
|
||||||
|
void usfatal (const std::string& message);
|
||||||
|
|
||||||
|
|
||||||
|
void info_spec(const std::string& message, const std::string& func, const std::string& file, int line);
|
||||||
|
void sinfo_spec(const std::string& message, const std::string& func, const std::string& file, int line);
|
||||||
|
void usinfo_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 sverbose_spec(const std::string& message, const std::string& func, const std::string& file, int line);
|
||||||
|
void usverbose_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 sdebug_spec(const std::string& message, const std::string& func, const std::string& file, int line);
|
||||||
|
void usdebug_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 swarning_spec(const std::string& message, const std::string& func, const std::string& file, int line);
|
||||||
|
void uswarning_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 serror_spec(const std::string& message, const std::string& func, const std::string& file, int line);
|
||||||
|
void userror_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);
|
||||||
|
void sfatal_spec(const std::string& message, const std::string& func, const std::string& file, int line);
|
||||||
|
void usfatal_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 SINFO(i) jlog::sinfo_spec(i, __PRETTY_FUNCTION__, __FILE__, __LINE__);
|
||||||
|
#define USINFO(i) jlog::usinfo_spec(i, __PRETTY_FUNCTION__, __FILE__, __LINE__);
|
||||||
|
|
||||||
|
|
||||||
|
#define VERBOSE(i) jlog::verbose_spec(i, __PRETTY_FUNCTION__, __FILE__, __LINE__);
|
||||||
|
#define SVERBOSE(i) jlog::sverbose_spec(i, __PRETTY_FUNCTION__, __FILE__, __LINE__);
|
||||||
|
#define USVERBOSE(i) jlog::usverbose_spec(i, __PRETTY_FUNCTION__, __FILE__, __LINE__);
|
||||||
|
|
||||||
|
|
||||||
|
#define DEBUG(i) jlog::debug_spec(i, __PRETTY_FUNCTION__, __FILE__, __LINE__);
|
||||||
|
#define SDEBUG(i) jlog::sdebug_spec(i, __PRETTY_FUNCTION__, __FILE__, __LINE__);
|
||||||
|
#define USDEBUG(i) jlog::usdebug_spec(i, __PRETTY_FUNCTION__, __FILE__, __LINE__);
|
||||||
|
|
||||||
|
|
||||||
|
#define WARNING(i) jlog::warning_spec(i, __PRETTY_FUNCTION__, __FILE__, __LINE__);
|
||||||
|
#define SWARNING(i) jlog::swarning_spec(i, __PRETTY_FUNCTION__, __FILE__, __LINE__);
|
||||||
|
#define USWARNING(i) jlog::uswarning_spec(i, __PRETTY_FUNCTION__, __FILE__, __LINE__);
|
||||||
|
|
||||||
|
|
||||||
|
#define ERROR(i) jlog::error_spec(i, __PRETTY_FUNCTION__, __FILE__, __LINE__);
|
||||||
|
#define SERROR(i) jlog::serror_spec(i, __PRETTY_FUNCTION__, __FILE__, __LINE__);
|
||||||
|
#define USERROR(i) jlog::userror_spec(i, __PRETTY_FUNCTION__, __FILE__, __LINE__);
|
||||||
|
|
||||||
|
|
||||||
|
#define FATAL(i) jlog::fatal_spec(i, __PRETTY_FUNCTION__, __FILE__, __LINE__);
|
||||||
|
#define SFATAL(i) jlog::sfatal_spec(i, __PRETTY_FUNCTION__, __FILE__, __LINE__);
|
||||||
|
#define USFATAL(i) jlog::usfatal_spec(i, __PRETTY_FUNCTION__, __FILE__, __LINE__);
|
29
main.cpp
29
main.cpp
@@ -1,15 +1,28 @@
|
|||||||
#include <jlog/ansi_escape_codes.hpp>
|
|
||||||
#include <jlog/jlog.hpp>
|
#include <jlog/jlog.hpp>
|
||||||
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
jlog::info("Do the needful!");
|
INFO("This is barely useful information.");
|
||||||
jlog::debug("Debugging Message 123");
|
DEBUG("Debugging Information");
|
||||||
jlog::error("Big problem!");
|
VERBOSE("Yadda Yadda Yadda");
|
||||||
jlog::verbose("Irrelevant message...");
|
WARNING("Slight miscalculation!");
|
||||||
jlog::warning("Our software suite is only supported on C++20! Get with it grampa.");
|
ERROR("Oops, something went wrong.");
|
||||||
jlog::fatal("FUCK BRO");
|
FATAL("Unrecoverable Error!!!");
|
||||||
|
|
||||||
|
SINFO("This is even less useful information.");
|
||||||
|
SDEBUG("Shorter Debugging Information");
|
||||||
|
SVERBOSE("Yadda Yadda");
|
||||||
|
SWARNING("Minute miscalculation!");
|
||||||
|
SERROR("Oops, something went wrong, but the programmer used the short error logger so you're fucked!");
|
||||||
|
SFATAL("Unrecoverable Error, but the programmer used the short fatal logger so you're even more fucked!!!");
|
||||||
|
|
||||||
|
USINFO("This is EVEN less useful information.");
|
||||||
|
USDEBUG("Ultra compact debugging information.");
|
||||||
|
USVERBOSE("Isn't this an oxymoron?");
|
||||||
|
USWARNING("Captain Quark grade miscalculation!");
|
||||||
|
USERROR("You're fucked!");
|
||||||
|
USFATAL("You're super fucked!!!");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
///
|
///
|
||||||
}
|
}
|
@@ -8,7 +8,6 @@ namespace jlog {
|
|||||||
static void log_to_console(const std::string& message);
|
static void log_to_console(const std::string& message);
|
||||||
static void log_to_file(const std::string& message);
|
static void log_to_file(const std::string& message);
|
||||||
|
|
||||||
|
|
||||||
std::string get_timestamp()
|
std::string get_timestamp()
|
||||||
{
|
{
|
||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
@@ -63,6 +62,21 @@ namespace jlog {
|
|||||||
log({timestamp, severity, content});
|
log({timestamp, severity, content});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sinfo(const std::string &message) {
|
||||||
|
//auto timestamp = token{.content = get_timestamp()};
|
||||||
|
auto severity = token{.colorCode = ansi_escape_codes::FG_WHITE, .content = "INFO"};
|
||||||
|
auto content = token{.content = message, .delimiter = ""};
|
||||||
|
//auto trace = token{.content = };
|
||||||
|
log({severity, content});
|
||||||
|
}
|
||||||
|
void usinfo(const std::string &message) {
|
||||||
|
//auto timestamp = token{.content = get_timestamp()};
|
||||||
|
auto severity = token{.colorCode = ansi_escape_codes::FG_WHITE, .content = "INFO"};
|
||||||
|
auto content = token{.content = message, .delimiter = ""};
|
||||||
|
//auto trace = token{.content = };
|
||||||
|
log({severity, content});
|
||||||
|
}
|
||||||
|
|
||||||
void verbose(const std::string &message) {
|
void verbose(const std::string &message) {
|
||||||
auto timestamp = token{.content = get_timestamp()};
|
auto timestamp = token{.content = get_timestamp()};
|
||||||
auto severity = token{.colorCode = ansi_escape_codes::FG_CYAN, .content = "VERBOSE"};
|
auto severity = token{.colorCode = ansi_escape_codes::FG_CYAN, .content = "VERBOSE"};
|
||||||
@@ -72,6 +86,24 @@ namespace jlog {
|
|||||||
//log(ansi_escape_codes::FG_CYAN, "VERBOSE", message);
|
//log(ansi_escape_codes::FG_CYAN, "VERBOSE", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sverbose(const std::string &message) {
|
||||||
|
//auto timestamp = token{.content = get_timestamp()};
|
||||||
|
auto severity = token{.colorCode = ansi_escape_codes::FG_CYAN, .content = "VERBOSE"};
|
||||||
|
auto content = token{.content = message, .delimiter = ""};
|
||||||
|
//auto trace = token{.content = };
|
||||||
|
log({severity, content});
|
||||||
|
//log(ansi_escape_codes::FG_CYAN, "VERBOSE", message);
|
||||||
|
}
|
||||||
|
|
||||||
|
void usverbose(const std::string &message) {
|
||||||
|
//auto timestamp = token{.content = get_timestamp()};
|
||||||
|
auto severity = token{.colorCode = ansi_escape_codes::FG_CYAN, .content = "VERBOSE"};
|
||||||
|
auto content = token{.content = message, .delimiter = ""};
|
||||||
|
//auto trace = token{.content = };
|
||||||
|
log({severity, content});
|
||||||
|
//log(ansi_escape_codes::FG_CYAN, "VERBOSE", message);
|
||||||
|
}
|
||||||
|
|
||||||
void debug(const std::string &message) {
|
void debug(const std::string &message) {
|
||||||
auto timestamp = token{.content = get_timestamp()};
|
auto timestamp = token{.content = get_timestamp()};
|
||||||
auto severity = token{.colorCode = ansi_escape_codes::FG_GREEN, .content = "DEBUG"};
|
auto severity = token{.colorCode = ansi_escape_codes::FG_GREEN, .content = "DEBUG"};
|
||||||
@@ -81,6 +113,22 @@ namespace jlog {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sdebug(const std::string &message) {
|
||||||
|
//auto timestamp = token{.content = get_timestamp()};
|
||||||
|
auto severity = token{.colorCode = ansi_escape_codes::FG_GREEN, .content = "DEBUG"};
|
||||||
|
auto content = token{.content = message, .delimiter = ""};
|
||||||
|
//auto trace = token{.content = };
|
||||||
|
log({severity, content});
|
||||||
|
}
|
||||||
|
|
||||||
|
void usdebug(const std::string &message) {
|
||||||
|
//auto timestamp = token{.content = get_timestamp()};
|
||||||
|
auto severity = token{.colorCode = ansi_escape_codes::FG_GREEN, .content = "DEBUG"};
|
||||||
|
auto content = token{.content = message, .delimiter = ""};
|
||||||
|
//auto trace = token{.content = };
|
||||||
|
log({severity, content});
|
||||||
|
}
|
||||||
|
|
||||||
void warning(const std::string &message) {
|
void warning(const std::string &message) {
|
||||||
auto timestamp = token{.content = get_timestamp()};
|
auto timestamp = token{.content = get_timestamp()};
|
||||||
auto severity = token{.colorCode = ansi_escape_codes::FG_YELLOW, .content = "WARNING"};
|
auto severity = token{.colorCode = ansi_escape_codes::FG_YELLOW, .content = "WARNING"};
|
||||||
@@ -90,6 +138,15 @@ namespace jlog {
|
|||||||
//log(ansi_escape_codes::FG_YELLOW, "WARNING", message);
|
//log(ansi_escape_codes::FG_YELLOW, "WARNING", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void uswarning(const std::string &message) {
|
||||||
|
//auto timestamp = token{.content = get_timestamp()};
|
||||||
|
auto severity = token{.colorCode = ansi_escape_codes::FG_YELLOW, .content = "WARNING"};
|
||||||
|
auto content = token{.content = message, .delimiter = ""};
|
||||||
|
//auto trace = token{.content = };
|
||||||
|
log({severity, content});
|
||||||
|
//log(ansi_escape_codes::FG_YELLOW, "WARNING", message);
|
||||||
|
}
|
||||||
|
|
||||||
void error(const std::string &message) {
|
void error(const std::string &message) {
|
||||||
auto timestamp = token{.content = get_timestamp()};
|
auto timestamp = token{.content = get_timestamp()};
|
||||||
auto severity = token{.colorCode = ansi_escape_codes::FG_RED, .content = "ERROR"};
|
auto severity = token{.colorCode = ansi_escape_codes::FG_RED, .content = "ERROR"};
|
||||||
@@ -99,14 +156,210 @@ namespace jlog {
|
|||||||
//log(ansi_escape_codes::FG_RED, "ERROR", message);
|
//log(ansi_escape_codes::FG_RED, "ERROR", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void userror(const std::string &message) {
|
||||||
|
//auto timestamp = token{.content = get_timestamp()};
|
||||||
|
auto severity = token{.colorCode = ansi_escape_codes::FG_RED, .content = "ERROR"};
|
||||||
|
auto content = token{.content = message, .delimiter = ""};
|
||||||
|
//auto trace = token{.content = };
|
||||||
|
log({severity, content});
|
||||||
|
//log(ansi_escape_codes::FG_RED, "ERROR", message);
|
||||||
|
}
|
||||||
|
|
||||||
void fatal(const std::string &message) {
|
void fatal(const std::string &message) {
|
||||||
auto timestamp = token{.content = get_timestamp()};
|
auto timestamp = token{.content = get_timestamp()};
|
||||||
auto severity = token{.colorCode = ansi_escape_codes::FG_BRIGHT_RED, .content = "FATAL"};
|
auto severity = token{.colorCode = ansi_escape_codes::FG_BRIGHT_RED, .content = "FATAL"};
|
||||||
auto content = token{.content = message, .delimiter = ""};
|
auto content = token{.content = message, .delimiter = ""};
|
||||||
auto trace = token{.content = __PRETTY_FUNCTION__};
|
|
||||||
auto source = std::source_location::current();
|
log({timestamp, severity, content});
|
||||||
auto file = token{.content = std::format("{}:{}", __FILE__, __LINE__)};
|
|
||||||
log({timestamp, trace, file, severity, content});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void usfatal(const std::string &message) {
|
||||||
|
//auto timestamp = token{.content = get_timestamp()};
|
||||||
|
auto severity = token{.colorCode = ansi_escape_codes::FG_BRIGHT_RED, .content = "FATAL"};
|
||||||
|
auto content = token{.content = message, .delimiter = ""};
|
||||||
|
|
||||||
|
log({severity, content});
|
||||||
|
}
|
||||||
|
|
||||||
|
void info_spec(const std::string &message, const std::string &func, const std::string &file,
|
||||||
|
int line) {
|
||||||
|
auto timestamp = token{.content = get_timestamp()};
|
||||||
|
auto severity = token{.colorCode = ansi_escape_codes::FG_WHITE, .content = "INFO"};
|
||||||
|
auto content = token{.content = message, .delimiter = ""};
|
||||||
|
auto trace = token{.content = func};
|
||||||
|
auto filedata = token{.content = std::format("{}:{}", file, line)};
|
||||||
|
log({timestamp, trace, filedata, severity, content});
|
||||||
|
}
|
||||||
|
|
||||||
|
void sinfo_spec(const std::string &message, const std::string &func, const std::string &file,
|
||||||
|
int line) {
|
||||||
|
//auto timestamp = token{.content = get_timestamp()};
|
||||||
|
auto severity = token{.colorCode = ansi_escape_codes::FG_WHITE, .content = "INFO"};
|
||||||
|
auto content = token{.content = message, .delimiter = ""};
|
||||||
|
auto trace = token{.content = func};
|
||||||
|
auto filedata = token{.content = std::format("{}:{}", file, line)};
|
||||||
|
log({trace, filedata, severity, content});
|
||||||
|
//log({severity, content});
|
||||||
|
}
|
||||||
|
|
||||||
|
void usinfo_spec(const std::string &message, const std::string &func, const std::string &file,
|
||||||
|
int line) {
|
||||||
|
//auto timestamp = token{.content = get_timestamp()};
|
||||||
|
auto severity = token{.colorCode = ansi_escape_codes::FG_WHITE, .content = "INFO"};
|
||||||
|
auto content = token{.content = message, .delimiter = ""};
|
||||||
|
//auto trace = token{.content = func};
|
||||||
|
//auto filedata = token{.content = std::format("{}:{}", file, line)};
|
||||||
|
//log({trace, filedata, severity, content});
|
||||||
|
log({severity, content});
|
||||||
|
}
|
||||||
|
|
||||||
|
void verbose_spec(const std::string &message, const std::string &func, const std::string &file,
|
||||||
|
int line) {
|
||||||
|
auto timestamp = token{.content = get_timestamp()};
|
||||||
|
auto severity = token{.colorCode = ansi_escape_codes::FG_CYAN, .content = "VERBOSE"};
|
||||||
|
auto content = token{.content = message, .delimiter = ""};
|
||||||
|
auto trace = token{.content = func};
|
||||||
|
auto filedata = token{.content = std::format("{}:{}", file, line)};
|
||||||
|
log({timestamp, trace, filedata, severity, content});
|
||||||
|
}
|
||||||
|
|
||||||
|
void sverbose_spec(const std::string &message, const std::string &func, const std::string &file,
|
||||||
|
int line) {
|
||||||
|
//auto timestamp = token{.content = get_timestamp()};
|
||||||
|
auto severity = token{.colorCode = ansi_escape_codes::FG_CYAN, .content = "VERBOSE"};
|
||||||
|
auto content = token{.content = message, .delimiter = ""};
|
||||||
|
auto trace = token{.content = func};
|
||||||
|
auto filedata = token{.content = std::format("{}:{}", file, line)};
|
||||||
|
log({trace, filedata, severity, content});
|
||||||
|
}
|
||||||
|
|
||||||
|
void usverbose_spec(const std::string &message, const std::string &func, const std::string &file,
|
||||||
|
int line) {
|
||||||
|
//auto timestamp = token{.content = get_timestamp()};
|
||||||
|
auto severity = token{.colorCode = ansi_escape_codes::FG_CYAN, .content = "VERBOSE"};
|
||||||
|
auto content = token{.content = message, .delimiter = ""};
|
||||||
|
//auto trace = token{.content = func};
|
||||||
|
//auto filedata = token{.content = std::format("{}:{}", file, line)};
|
||||||
|
log({severity, content});
|
||||||
|
}
|
||||||
|
|
||||||
|
void debug_spec(const std::string &message, const std::string &func, const std::string &file,
|
||||||
|
int line) {
|
||||||
|
auto timestamp = token{.content = get_timestamp()};
|
||||||
|
auto severity = token{.colorCode = ansi_escape_codes::FG_GREEN, .content = "DEBUG"};
|
||||||
|
auto content = token{.content = message, .delimiter = ""};
|
||||||
|
auto trace = token{.content = func};
|
||||||
|
auto filedata = token{.content = std::format("{}:{}", file, line)};
|
||||||
|
log({timestamp, trace, filedata, severity, content});
|
||||||
|
}
|
||||||
|
|
||||||
|
void sdebug_spec(const std::string &message, const std::string &func, const std::string &file,
|
||||||
|
int line) {
|
||||||
|
//auto timestamp = token{.content = get_timestamp()};
|
||||||
|
auto severity = token{.colorCode = ansi_escape_codes::FG_GREEN, .content = "DEBUG"};
|
||||||
|
auto content = token{.content = message, .delimiter = ""};
|
||||||
|
auto trace = token{.content = func};
|
||||||
|
auto filedata = token{.content = std::format("{}:{}", file, line)};
|
||||||
|
log({trace, filedata, severity, content});
|
||||||
|
}
|
||||||
|
|
||||||
|
void usdebug_spec(const std::string &message, const std::string &func, const std::string &file,
|
||||||
|
int line) {
|
||||||
|
//auto timestamp = token{.content = get_timestamp()};
|
||||||
|
auto severity = token{.colorCode = ansi_escape_codes::FG_GREEN, .content = "DEBUG"};
|
||||||
|
auto content = token{.content = message, .delimiter = ""};
|
||||||
|
//auto trace = token{.content = func};
|
||||||
|
//auto filedata = token{.content = std::format("{}:{}", file, line)};
|
||||||
|
log({severity, content});
|
||||||
|
}
|
||||||
|
|
||||||
|
void warning_spec(const std::string &message, const std::string &func, const std::string &file,
|
||||||
|
int line) {
|
||||||
|
auto timestamp = token{.content = get_timestamp()};
|
||||||
|
auto severity = token{.colorCode = ansi_escape_codes::FG_YELLOW, .content = "WARNING"};
|
||||||
|
auto content = token{.content = message, .delimiter = ""};
|
||||||
|
auto trace = token{.content = func};
|
||||||
|
auto filedata = token{.content = std::format("{}:{}", file, line)};
|
||||||
|
log({timestamp, trace, filedata, severity, content});
|
||||||
|
}
|
||||||
|
|
||||||
|
void swarning_spec(const std::string &message, const std::string &func, const std::string &file,
|
||||||
|
int line) {
|
||||||
|
//auto timestamp = token{.content = get_timestamp()};
|
||||||
|
auto severity = token{.colorCode = ansi_escape_codes::FG_YELLOW, .content = "WARNING"};
|
||||||
|
auto content = token{.content = message, .delimiter = ""};
|
||||||
|
auto trace = token{.content = func};
|
||||||
|
auto filedata = token{.content = std::format("{}:{}", file, line)};
|
||||||
|
log({trace, filedata, severity, content});
|
||||||
|
}
|
||||||
|
|
||||||
|
void uswarning_spec(const std::string &message, const std::string &func, const std::string &file,
|
||||||
|
int line) {
|
||||||
|
//auto timestamp = token{.content = get_timestamp()};
|
||||||
|
auto severity = token{.colorCode = ansi_escape_codes::FG_YELLOW, .content = "WARNING"};
|
||||||
|
auto content = token{.content = message, .delimiter = ""};
|
||||||
|
//auto trace = token{.content = func};
|
||||||
|
//auto filedata = token{.content = std::format("{}:{}", file, line)};
|
||||||
|
log({severity, content});
|
||||||
|
}
|
||||||
|
|
||||||
|
void error_spec(const std::string &message, const std::string &func, const std::string &file,
|
||||||
|
int line) {
|
||||||
|
auto timestamp = token{.content = get_timestamp()};
|
||||||
|
auto severity = token{.colorCode = ansi_escape_codes::FG_RED, .content = "ERROR"};
|
||||||
|
auto content = token{.content = message, .delimiter = ""};
|
||||||
|
auto trace = token{.content = func};
|
||||||
|
auto filedata = token{.content = std::format("{}:{}", file, line)};
|
||||||
|
log({timestamp, trace, filedata, severity, content});
|
||||||
|
}
|
||||||
|
|
||||||
|
void serror_spec(const std::string &message, const std::string &func, const std::string &file,
|
||||||
|
int line) {
|
||||||
|
//auto timestamp = token{.content = get_timestamp()};
|
||||||
|
auto severity = token{.colorCode = ansi_escape_codes::FG_RED, .content = "ERROR"};
|
||||||
|
auto content = token{.content = message, .delimiter = ""};
|
||||||
|
auto trace = token{.content = func};
|
||||||
|
auto filedata = token{.content = std::format("{}:{}", file, line)};
|
||||||
|
log({trace, filedata, severity, content});
|
||||||
|
}
|
||||||
|
|
||||||
|
void userror_spec(const std::string &message, const std::string &func, const std::string &file,
|
||||||
|
int line) {
|
||||||
|
//auto timestamp = token{.content = get_timestamp()};
|
||||||
|
auto severity = token{.colorCode = ansi_escape_codes::FG_RED, .content = "ERROR"};
|
||||||
|
auto content = token{.content = message, .delimiter = ""};
|
||||||
|
//auto trace = token{.content = func};
|
||||||
|
//auto filedata = token{.content = std::format("{}:{}", file, line)};
|
||||||
|
log({severity, content});
|
||||||
|
}
|
||||||
|
|
||||||
|
void fatal_spec(const std::string &message, const std::string &func, const std::string &file,
|
||||||
|
int line) {
|
||||||
|
auto timestamp = token{.content = get_timestamp()};
|
||||||
|
auto severity = token{.colorCode = ansi_escape_codes::FG_BRIGHT_RED, .content = "FATAL"};
|
||||||
|
auto content = token{.content = message, .delimiter = ""};
|
||||||
|
auto trace = token{.content = func};
|
||||||
|
auto filedata = token{.content = std::format("{}:{}", file, line)};
|
||||||
|
log({timestamp, trace, filedata, severity, content});
|
||||||
|
}
|
||||||
|
|
||||||
|
void sfatal_spec(const std::string &message, const std::string &func, const std::string &file,
|
||||||
|
int line) {
|
||||||
|
auto timestamp = token{.content = get_timestamp()};
|
||||||
|
auto severity = token{.colorCode = ansi_escape_codes::FG_BRIGHT_RED, .content = "FATAL"};
|
||||||
|
auto content = token{.content = message, .delimiter = ""};
|
||||||
|
auto trace = token{.content = func};
|
||||||
|
auto filedata = token{.content = std::format("{}:{}", file, line)};
|
||||||
|
log({trace, filedata, severity, content});
|
||||||
|
}
|
||||||
|
|
||||||
|
void usfatal_spec(const std::string &message, const std::string &func, const std::string &file,
|
||||||
|
int line) {
|
||||||
|
auto timestamp = token{.content = get_timestamp()};
|
||||||
|
auto severity = token{.colorCode = ansi_escape_codes::FG_BRIGHT_RED, .content = "FATAL"};
|
||||||
|
auto content = token{.content = message, .delimiter = ""};
|
||||||
|
//auto trace = token{.content = func};
|
||||||
|
//auto filedata = token{.content = std::format("{}:{}", file, line)};
|
||||||
|
log({severity, content});
|
||||||
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user