YourGameLib
Loading...
Searching...
No Matches
log.h
Go to the documentation of this file.
1/*
2Copyright (c) 2019-2024 Alexander Scholz
3
4This software is provided 'as-is', without any express or implied
5warranty. In no event will the authors be held liable for any damages
6arising from the use of this software.
7
8Permission is granted to anyone to use this software for any purpose,
9including commercial applications, and to alter it and redistribute it
10freely, subject to the following restrictions:
11
121. The origin of this software must not be misrepresented; you must not
13 claim that you wrote the original software. If you use this software
14 in a product, an acknowledgment in the product documentation would be
15 appreciated but is not required.
162. Altered source versions must be plainly marked as such, and must not be
17 misrepresented as being the original software.
183. This notice may not be removed or altered from any source distribution.
19*/
20#ifndef YOURGAME_LOG_H
21#define YOURGAME_LOG_H
22
23#include "easylogging++.h"
24
25namespace yourgame
26{
27 namespace log
28 {
30 template <typename T, typename... Args>
31 inline void debug(const char *s, const T &value, const Args &...args)
32 {
33#ifndef NDEBUG
34 el::Logger *logr = el::Loggers::getLogger("default");
35 if (logr != nullptr)
36 logr->debug(s, value, args...);
37#endif
38 }
39
41 template <typename T>
42 inline void debug(const T &value)
43 {
44#ifndef NDEBUG
45 el::Logger *logr = el::Loggers::getLogger("default");
46 if (logr != nullptr)
47 logr->debug(value);
48#endif
49 }
50
52 template <typename T, typename... Args>
53 inline void info(const char *s, const T &value, const Args &...args)
54 {
55 el::Logger *logr = el::Loggers::getLogger("default");
56 if (logr != nullptr)
57 logr->info(s, value, args...);
58 }
59
61 template <typename T>
62 inline void info(const T &value)
63 {
64 el::Logger *logr = el::Loggers::getLogger("default");
65 if (logr != nullptr)
66 logr->info(value);
67 }
68
70 template <typename T, typename... Args>
71 inline void warn(const char *s, const T &value, const Args &...args)
72 {
73 el::Logger *logr = el::Loggers::getLogger("default");
74 if (logr != nullptr)
75 logr->warn(s, value, args...);
76 }
77
79 template <typename T>
80 inline void warn(const T &value)
81 {
82 el::Logger *logr = el::Loggers::getLogger("default");
83 if (logr != nullptr)
84 logr->warn(value);
85 }
86
88 template <typename T, typename... Args>
89 inline void error(const char *s, const T &value, const Args &...args)
90 {
91 el::Logger *logr = el::Loggers::getLogger("default");
92 if (logr != nullptr)
93 logr->error(s, value, args...);
94 }
95
97 template <typename T>
98 inline void error(const T &value)
99 {
100 el::Logger *logr = el::Loggers::getLogger("default");
101 if (logr != nullptr)
102 logr->error(value);
103 }
104 } // namespace log
105} // namespace yourgame
106
107#endif
void info(const char *s, const T &value, const Args &...args)
log info
Definition log.h:53
void debug(const char *s, const T &value, const Args &...args)
log debug
Definition log.h:31
void error(const char *s, const T &value, const Args &...args)
log error
Definition log.h:89
void warn(const char *s, const T &value, const Args &...args)
log warning
Definition log.h:71
Definition audio.h:27