From 2d30f660307eb7e49581dabc69f30eaf59a79e39 Mon Sep 17 00:00:00 2001 From: Rick van Vonderen <0945444@hr.nl> Date: Mon, 16 Dec 2019 00:18:45 +0100 Subject: [PATCH] Add std::string support to Log --- inferno/src/inferno/log.h | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/inferno/src/inferno/log.h b/inferno/src/inferno/log.h index 335756e..0e91a43 100644 --- a/inferno/src/inferno/log.h +++ b/inferno/src/inferno/log.h @@ -4,6 +4,7 @@ #include // sprintf, printf #include // strlen #include // shared_ptr +#include // string namespace Inferno { @@ -39,31 +40,37 @@ namespace Inferno { } template - void log(const char* format, A... arguments) + void print(const char* color, std::string format, A... arguments) + { + this->print(color, format.c_str(), arguments...); + } + + template + void log(T format, A... arguments) { this->print("", format, arguments...); } - template - void info(const char* format, A... arguments) + template + void info(T format, A... arguments) { this->print("\x1B[34m", format, arguments...); } - template - void warn(const char* format, A... arguments) + template + void warn(T format, A... arguments) { this->print("\x1B[33m", format, arguments...); } - template - void danger(const char* format, A... arguments) + template + void danger(T format, A... arguments) { this->print("\x1B[31m", format, arguments...); } - template - void success(const char* format, A... arguments) + template + void success(T format, A... arguments) { this->print("\x1B[32m", format, arguments...); }