-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogging.h
45 lines (42 loc) · 1.39 KB
/
logging.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef BARS_TOOL_LOGGING_H
#define BARS_TOOL_LOGGING_H
#include <styler.hpp>
#include <format>
namespace logging {
template <typename... Args>
void log(std::string_view fmt_str, Args&&... args)
{
std::cout
<< std::vformat(fmt_str, std::make_format_args(args...))
<< std::endl;
}
template <typename... Args>
void info(std::string_view fmt_str, Args&&... args)
{
std::cout << "[INFO] "
<< std::vformat(fmt_str, std::make_format_args(args...))
<< std::endl;
}
template <typename... Args>
void warn(std::string_view fmt_str, Args&&... args)
{
std::cout << styler::Foreground::Yellow << "[WARN] "
<< std::vformat(fmt_str, std::make_format_args(args...))
<< styler::Style::Reset << std::endl;
}
template <typename... Args>
void fatal(std::string_view fmt_str, Args&&... args)
{
std::cout << styler::Foreground::Red << "[FATAL] "
<< std::vformat(fmt_str, std::make_format_args(args...))
<< styler::Style::Reset << std::endl;
}
template <typename... Args>
void funny(std::string_view fmt_str, Args&&... args)
{
std::cout << styler::Foreground::Green << "[FUNNY] "
<< std::vformat(fmt_str, std::make_format_args(args...))
<< styler::Style::Reset << std::endl;
}
}
#endif //BARS_TOOL_LOGGING_H