Files
spark/src/lib/logging/LogRec.h
T
John Colvin 9f0a24f1ec fix build (client): Change 'WIN32' macros to '_WIN32'
Not sure exactly how this broke, but the WIN32 macro is no longer defined.
2023-09-18 21:38:28 +00:00

44 lines
906 B
C++

#pragma once
#include "lib/utils/warn_ctrl.h"
#include "Common.h"
#include "MsgPacking.h"
namespace bts {
namespace log {
using ArgUnpacker = std::string (*) (ArgBuffer const&b, const char*msg_template);
GCC_DIAG_OFF("-Weffc++")
struct LogRec {
uint64_t ts;
const char *file;
const char *msg_template;
ArgUnpacker unpacker;
uint16_t line;
Level level;
Subsystem subsystem;
ArgBuffer args;
template <typename... Args>
void pack_msg (const char *msg_t, Args&&... msg_args) {
msg_template = msg_t;
unpacker = unpack_msg_args<sizeof(ArgBuffer),typename std::remove_reference<Args>::type...>;
pack_msg_args(args,std::forward<Args>(msg_args)...);
}
std::string unpack_msg()
{
return unpacker(args,msg_template);
}
};
GCC_DIAG_RESTORE()
#ifndef _WIN32
// static_assert(sizeof(LogRec) == 256, "LogRec should be 128 bytes");
#endif
}}