summaryrefslogtreecommitdiff
path: root/src/log.hpp
blob: 5e5f1d39c8a577da41cce056e63d8e1bda2dc98f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#pragma once
#include "format.hpp"
#include <format>
#include <print>
#include <string>

inline void log(FILE *_stream, eFormatType type, std::string str) {
	std::println(_stream, "{}", NFormatter::fmt(type, str));
}

inline void log(eFormatType type, std::string str) {
	log(stdout, type, str);
}

template <typename... Args>
void log(FILE *_stream, eFormatType type, std::format_string<Args...> fmt, Args &&...args) {
	log(_stream, type, std::format(fmt, std::forward<Args>(args)...));
}

template <typename... Args>
void log(eFormatType type, std::format_string<Args...> fmt, Args &&...args) {
	log(stdout, type, std::format(fmt, std::forward<Args>(args)...));
}