JNGL
Easy to use cross-platform 2D game library
Loading...
Searching...
No Matches
log.hpp
Go to the documentation of this file.
1// Copyright 2024 Jan Niklas Hasse <jhasse@gmail.com>
2// For conditions of distribution and use, see copyright notice in LICENSE.txt
5#pragma once
6
7#if __has_include(<format>) && (!defined(_LIBCPP_VERSION) || _LIBCPP_VERSION >= 170000)
8#include <format>
9#endif
10#include <string>
11
12namespace jngl {
13
14void trace(const std::string&);
15
16#if __has_include(<format>) && (!defined(_LIBCPP_VERSION) || _LIBCPP_VERSION >= 170000)
17template <class... Args> void trace(std::format_string<Args...> format, Args&&... args) {
18 return trace(std::format(std::move(format), std::forward<Args>(args)...));
19}
20#else
21template <class... Args> void trace(Args&&...) {}
22#endif
23
24void info(const std::string&);
25
26#if __has_include(<format>) && (!defined(_LIBCPP_VERSION) || _LIBCPP_VERSION >= 170000)
27template <class... Args> void info(std::format_string<Args...> format, Args&&... args) {
28 return info(std::format(std::move(format), std::forward<Args>(args)...));
29}
30#else
31template <class... Args> void info(Args&&...) {}
32#endif
33
34void warn(const std::string&);
35
36#if __has_include(<format>) && (!defined(_LIBCPP_VERSION) || _LIBCPP_VERSION >= 170000)
37template <class... Args> void warn(std::format_string<Args...> format, Args&&... args) {
38 return warn(std::format(std::move(format), std::forward<Args>(args)...));
39}
40#else
41template <class... Args> void warn(Args&&...) {}
42#endif
43
44void error(const std::string&);
45
46#if __has_include(<format>) && (!defined(_LIBCPP_VERSION) || _LIBCPP_VERSION >= 170000)
47template <class... Args> void error(std::format_string<Args...> format, Args&&... args) {
48 return error(std::format(std::move(format), std::forward<Args>(args)...));
49}
50#else
51template <class... Args> void error(Args&&...) {}
52#endif
53
54} // namespace jngl
T format(T... args)
JNGL's main namespace.