HephAudio v3.1.0
A cross-platform C++ library for recording, playing, and processing audio on Windows, Android, Linux, iOS, and macOS.
Loading...
Searching...
No Matches
ConsoleLogger.h
Go to the documentation of this file.
1#pragma once
2#include "HephShared.h"
3#include <string>
4
7#define HEPH_CL_INFO "36"
8#define HEPH_CL_WARNING "33"
9#define HEPH_CL_ERROR "31"
10#define HEPH_CL_SUCCESS "32"
11#define HEPH_CL_DEBUG "35"
12
13namespace Heph
14{
20 {
21 private:
22#if defined(HEPH_CL_DISABLE_COLORED_OUTPUT)
23 static inline bool coloredOutput = false;
24#else
25 static inline bool coloredOutput = true;
26#endif
27
28 public:
29 ConsoleLogger() = delete;
30 ConsoleLogger(const ConsoleLogger&) = delete;
31 ConsoleLogger& operator=(const ConsoleLogger&) = delete;
32
33 public:
41 static void Log(const std::string& message, const char* logLevel);
42
51 static void Log(const std::string& message, const char* logLevel, const std::string& libName);
52
59 static void LogInfo(const std::string& message);
60
68 static void LogInfo(const std::string& message, const std::string& libName);
69
76 static void LogWarning(const std::string& message);
77
85 static void LogWarning(const std::string& message, const std::string& libName);
86
93 static void LogError(const std::string& message);
94
102 static void LogError(const std::string& message, const std::string& libName);
103
110 static void LogSuccess(const std::string& message);
111
119 static void LogSuccess(const std::string& message, const std::string& libName);
120
127 static void LogDebug(const std::string& message);
128
136 static void LogDebug(const std::string& message, const std::string& libName);
137
142 static void EnableColoredOutput();
143
148 static void DisableColoredOutput();
149
150 private:
151 static std::string CurrentTimeToString();
152 static std::string GetLogLevelName(const char* logLevel);
153 };
154}
#define HEPH_API
Definition HephShared.h:124
class for printing formatted messages to the console.
Definition ConsoleLogger.h:20
static void LogDebug(const std::string &message, const std::string &libName)
static void LogWarning(const std::string &message)
static void Log(const std::string &message, const char *logLevel)
static void EnableColoredOutput()
static void LogInfo(const std::string &message)
static void LogInfo(const std::string &message, const std::string &libName)
static void LogError(const std::string &message, const std::string &libName)
static void LogSuccess(const std::string &message, const std::string &libName)
static void LogError(const std::string &message)
static void DisableColoredOutput()
static void LogDebug(const std::string &message)
static void LogWarning(const std::string &message, const std::string &libName)
static void Log(const std::string &message, const char *logLevel, const std::string &libName)
static void LogSuccess(const std::string &message)