summaryrefslogtreecommitdiff
path: root/src/log.hpp
blob: 8cfc9172deaca7ebb9dda912a2da487c268851b1 (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)...));
}