Dynamic Neural Field Composer 0.0.0
A C++20 library and interactive application for building and simulating Dynamic Neural Field (DNF) architectures.
Loading...
Searching...
No Matches
logger.h
Go to the documentation of this file.
1#pragma once
2
3#include <iostream>
4#include <string>
5#include <chrono>
6#include <iomanip>
7#include <imgui-platform-kit/log_window.h>
8
10#include "utils.h"
11
12#ifdef ERROR
13#undef ERROR
14#endif
15
16
17
19{
28
29 enum LogOutputMode : int
30 {
33 ALL
34 };
35
36 class Logger
37 {
38 private:
39 LogLevel logLevel;
40 LogOutputMode outputMode;
41 static LogLevel minLogLevel;
42 public:
43 Logger(LogLevel level, LogOutputMode mode = ALL);
44 void log(const std::string& message) const;
45 static void setMinLogLevel(LogLevel level) { minLogLevel = level; }
46 private:
47 static std::string getLogLevelColorCodeCmd(LogLevel level);
48 static ImVec4 getLogLevelColorCodeGui(LogLevel level);
49 static std::string getLogLevelText(LogLevel level);
50 static void log_cmd(const std::string& message);
51 static void log_ui(ImVec4 color, const std::string& message);
52 };
53
54 void log(LogLevel level, const std::string& message, LogOutputMode mode = ALL);
55
57}
58
59
60
static void setMinLogLevel(LogLevel level)
Definition logger.h:45
void log(const std::string &message) const
Definition logger.cpp:15
Definition logger.h:19
LogOutputMode
Definition logger.h:30
@ ALL
Definition logger.h:33
@ CONSOLE
Definition logger.h:31
@ GUI
Definition logger.h:32
static Logger logger(LogLevel::INFO)
LogLevel
Definition logger.h:21
@ DEBUG
Definition logger.h:22
@ WARNING
Definition logger.h:24
@ FATAL
Definition logger.h:26
@ INFO
Definition logger.h:23
@ ERROR
Definition logger.h:25
void log(LogLevel level, const std::string &message, LogOutputMode mode=ALL)
Definition logger.cpp:78