Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
Logger.h
Go to the documentation of this file.
1/*
2Author : Tobias Stein
3Date : 11th September, 2016
4File : Logger.h
5
6Class that manages the logging.
7
8All Rights Reserved. (c) Copyright 2016.
9*/
10
11#if !defined(ECS_DISABLE_LOGGING)
12
13#pragma once
14#ifndef ECS__LOGGER_H__
15#define ECS__LOGGER_H__
16
17#include "Platform.h"
18
19#define ECS_DISABLE_INFO_LOG
20
21namespace ECS { namespace Log {
22
24 {
25 Logger(const Logger&) = delete;
26 Logger& operator=(Logger&) = delete;
27
28
29 public:
30
31 explicit Logger();
32
33 ~Logger();
34
35 // trace
36 template<typename... Args>
37 inline void LogTrace(const char* fmt, Args... args)
38 {
39 Divide::Console::printfn(fmt, FWD(args)...);
40 }
41
42 // debug
43 template<typename... Args>
44 inline void LogDebug(const char* fmt, Args... args)
45 {
46 Divide::Console::d_printfn(fmt, std::forward<Args>(args)...);
47 }
48
49 // info
50 template<typename... Args>
51 inline void LogInfo([[maybe_unused]] const char* fmt, [[maybe_unused]] Args... args)
52 {
53 #if !defined(ECS_DISABLE_INFO_LOG)
54 Divide::Console::printfn(fmt, std::forward<Args>(args)...);
55 #endif
56 }
57
58 // warn
59 template<typename... Args>
60 inline void LogWarning(const char* fmt, Args... args)
61 {
62 Divide::Console::warnfn(fmt, std::forward<Args>(args)...);
63 }
64
65 // error
66 template<typename... Args>
67 inline void LogError(const char* fmt, Args... args)
68 {
69 Divide::Console::errorfn(fmt, std::forward<Args>(args)...);
70 }
71
72 // fatal
73 template<typename... Args>
74 inline void LogFatal(const char* fmt, Args... args)
75 {
76 Divide::Console::errorfn(fmt, std::forward<Args>(args)...);
77 assert(false && "Fatal Error");
78 }
79
80 }; // class Logger
81
82
83}} // namespace ECS::Log
84
85
86#include "Log/LoggerMacro.h"
87
88
89#endif // ECS__LOGGER_H__
90#endif // !ECS_DISABLE_LOGGING
#define ECS_API
Definition: Platform.h:16
#define FWD(...)
void LogDebug(const char *fmt, Args... args)
Definition: Logger.h:44
void LogWarning(const char *fmt, Args... args)
Definition: Logger.h:60
void LogFatal(const char *fmt, Args... args)
Definition: Logger.h:74
void LogError(const char *fmt, Args... args)
Definition: Logger.h:67
void LogTrace(const char *fmt, Args... args)
Definition: Logger.h:37
Logger & operator=(Logger &)=delete
Logger(const Logger &)=delete
void LogInfo(const char *fmt, Args... args)
Definition: Logger.h:51
static NO_INLINE void d_printfn(const char *format, T &&... args)
static NO_INLINE void errorfn(const char *format, T &&... args)
static NO_INLINE void warnfn(const char *format, T &&... args)
static NO_INLINE void printfn(const char *format, T &&... args)