summaryrefslogtreecommitdiff
path: root/modules/io/c++/log.hpp
blob: b4e0663a17c01ea248bb5affb2c7fb859359e2dc (plain)
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
#pragma once

#include <forstio/codec/data.hpp>

#include <source_location>

namespace saw {
namespace schema {
using LogMessage = Struct<
	Member<UInt64, "level">,
	Member<String, "message">,
	Member<String, "file">,
	Member<UInt64, "line">
>;
}

class local_log final {
public:
	void send(uint64_t kind, const std::string_view& msg, const std::source_location& loc);
};

logger& get_local_logger();

template<typename Kind>
void log(const std::string_view& msg, const std::source_location& loc = std::source_location::current()){
	auto& lg = get_local_logger();

	lg.send(kind, msg, file, line);
}
}