Skip to content

Commit

Permalink
FORMAT-AUTO: automatic format on pull request #44
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Oct 4, 2023
1 parent 92eaee0 commit 3dadf0a
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 33 deletions.
47 changes: 24 additions & 23 deletions src/ECS/Logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,42 +109,43 @@ namespace Logger {
{
#ifdef __linux__
static std::map<LogLevel, std::string> colors = {
{LogLevel::Fatal, "\033[31m"},
{LogLevel::Error, "\033[33m"},
{LogLevel::Warn, "\033[34m"},
{LogLevel::Info, "\033[32m"},
{LogLevel::Debug, "\033[38m"},
{LogLevel::Trace, "\033[30m"},
{LogLevel::Fatal, "\033[31m"},
{LogLevel::Error, "\033[33m"},
{LogLevel::Warn, "\033[34m"},
{LogLevel::Info, "\033[32m"},
{LogLevel::Debug, "\033[38m"},
{LogLevel::Trace, "\033[30m"},
{LogLevel::MAXLOGLEVEL, "\033[0m" },
};
#elif __APPLE__
static std::map<int, std::string> colors = {
{LogLevel::Fatal, "\033[31m"},
{LogLevel::Error, "\033[33m"},
{LogLevel::Warn, "\033[34m"},
{LogLevel::Info, "\033[32m"},
{LogLevel::Debug, "\033[38m"},
{LogLevel::Trace, "\033[30m"},
{LogLevel::Fatal, "\033[31m"},
{LogLevel::Error, "\033[33m"},
{LogLevel::Warn, "\033[34m"},
{LogLevel::Info, "\033[32m"},
{LogLevel::Debug, "\033[38m"},
{LogLevel::Trace, "\033[30m"},
{LogLevel::MAXLOGLEVEL, "\033[0m" },
};
#else
static std::map<int, std::string> colors =
{
{LogLevel::Fatal,""},
{LogLevel::Error,""},
{LogLevel::Warn, ""},
{LogLevel::Info, ""},
{LogLevel::Debug,""},
{LogLevel::Trace,""},
{LogLevel::MAXLOG""},
static std::map<int, std::string> colors = {
{LogLevel::Fatal, ""},
{LogLevel::Error, ""},
{LogLevel::Warn,""},
{LogLevel::Info, ""},
{LogLevel::Debug, ""},
{LogLevel::Trace, ""},
{LogLevel::MAXLOG ""},
};
#endif

auto const now = std::chrono::current_zone()->to_local(std::chrono::system_clock::now());
auto const now = std::chrono::current_zone()->to_local(
std::chrono::system_clock::now());
std::string mes;
auto it = _callbacks.find(levelT);

mes = std::format("{:%Y-%m-%d %H:%M:%S}", now) + " [" + level + "] " + message;
mes = std::format("{:%Y-%m-%d %H:%M:%S}", now) + " [" + level + "] "
+ message;
std::cerr << colors[levelT] << mes << colors[LogLevel::MAXLOGLEVEL]
<< std::endl;
if (it != _callbacks.end()) {
Expand Down
19 changes: 10 additions & 9 deletions src/ECS/Logger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@

namespace Logger {
enum class LogLevel : int {
NOLOG = -1,
Fatal = 0,
Error = 1,
Warn = 2,
Info = 3,
Debug = 4,
Trace = 5,
NOLOG = -1,
Fatal = 0,
Error = 1,
Warn = 2,
Info = 3,
Debug = 4,
Trace = 5,
MAXLOGLEVEL = 6,
};

Expand All @@ -39,8 +39,9 @@ namespace Logger {
* LogLevel::Error - `error` and `fatal` are displayed
* LogLevel::Warn - `warn`, `error` and `fatal` are displayed
* LogLevel::Info - `info`, `warn`, `error` and `fatal` are displayed
* LogLevel::Debug - `debug`, `info`, `warn`, `error` and `fatal` are displayed
* LogLevel::Trace - `trace`, `debug`, `info`, `warn`, `error` and `fatal` are displayed
* LogLevel::Debug - `debug`, `info`, `warn`, `error` and `fatal` are
* displayed LogLevel::Trace - `trace`, `debug`, `info`, `warn`, `error` and
* `fatal` are displayed
*
* Attention:
* `debug` and `trace` will only do something in debug mode compilation.
Expand Down
2 changes: 1 addition & 1 deletion src/main_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
** main
*/

#include "SceneManager.hpp"
#include "Logger.hpp"
#include "SceneManager.hpp"

int main()
{
Expand Down

0 comments on commit 3dadf0a

Please sign in to comment.