9#define NNGN_LOG_CONTEXT(n) NNGN_LOG_CONTEXT2(n, nullptr)
10#define NNGN_LOG_CONTEXT_F() NNGN_LOG_CONTEXT2(__func__, nullptr)
11#define NNGN_LOG_CONTEXT_CF(c) NNGN_LOG_CONTEXT2(#c, __func__)
12#define NNGN_LOG_CONTEXT2(n0, n1) \
13 const auto NNGN_LOG_CONTEXT_VAR(__LINE__) = nngn::Log::context(n0, n1);
14#define NNGN_LOG_CONTEXT_VAR(l) NNGN_LOG_CONTEXT_JOIN(lc_, l)
15#define NNGN_LOG_CONTEXT_JOIN(x, y) x##y
24 static thread_local uint8_t
depth;
25 using record = std::tuple<const char*, const char*>;
26 static thread_local std::array<record, MAX_DEPTH>
stack;
30 context(
const char *name0,
const char *name1);
47 static std::ostream *
set(std::ostream *
l);
48 static std::ostream &
l();
49 static void perror(
const char *
s =
nullptr);
50 template<
typename F>
static std::string
capture(F
f);
52 const char *
name, F
f);
name
Definition cathedral.lua:11
replace(const replace &&)=delete
replace(std::ostream *l)
Definition log.h:40
replace & operator=(const replace &&)=delete
~replace()
Definition log.h:45
replace(const replace &)=delete
replace & operator=(const replace &)=delete
std::ostream * old
Definition log.h:38
static std::ostream * set(std::ostream *l)
Definition log.cpp:53
static thread_local std::array< record, MAX_DEPTH > stack
Definition log.h:26
std::tuple< const char *, const char * > record
Definition log.h:25
static void perror(const char *s=nullptr)
Definition log.cpp:62
static thread_local uint8_t depth
Definition log.h:24
friend std::ostream & operator<<(std::ostream &os, Log::record r)
Definition log.cpp:29
static std::ostream * stream
Definition log.h:23
static std::ostream & l()
Definition log.cpp:56
static std::string capture(F f)
Definition log.h:56
static constexpr uint8_t MAX_DEPTH
Definition log.h:21
static with_context(const char *name, F f)
local r
Definition gamma.lua:7
#define NNGN_LOG_CONTEXT(n)
Definition log.h:9
set
Definition camera.lua:47
context(const context &&)=delete
~context()
Definition log.cpp:51
context(const char *name0, const char *name1)
Definition log.cpp:39
context & operator=(const context &)=delete
context(const context &)=delete
context & operator=(const context &&)=delete
std::chrono::seconds s
Definition timing.cpp:6