aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/util/dbg.h
blob: e4480702b7ec84a0c89722fd7decb886ce571922 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#pragma once

#include "Log.h"
#include "LogColor.h"

// utility macros
#define _crepe_logf_here(level, fmt, ...) \
	crepe::Log::logf( \
		level, "{}" fmt, \
		crepe::LogColor().fg_white(false).str( \
			std::format("{} ({}:{})", __PRETTY_FUNCTION__, __FILE_NAME__, __LINE__) \
		), \
		__VA_ARGS__ \
	)

// very illegal global function-style macros
// NOLINTBEGIN
#define dbg_logf(fmt, ...) _crepe_logf_here(crepe::Log::Level::DEBUG, ": " fmt, __VA_ARGS__)
#define dbg_log(str) _crepe_logf_here(crepe::Log::Level::DEBUG, ": {}", str)
#define dbg_trace() _crepe_logf_here(crepe::Log::Level::TRACE, "", "")
// NOLINTEND