MXL : Media eXchange Layer
MXL
Loading...
Searching...
No Matches
Logging.hpp
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2
// SPDX-License-Identifier: Apache-2.0
3
4
#pragma once
5
6
// In debug mode we keep all log statements.
7
// In release mode we only consider info and up.
8
// See : https://github.com/gabime/spdlog/wiki/0.-FAQ#how-to-remove-all-debug-statements-at-compile-time-
9
//
10
// Actual logging levels can be configured through the MXL_LOG_LEVEL environment variable
11
//
12
//
13
#ifndef SPDLOG_ACTIVE_LEVEL
14
# ifndef NDEBUG
15
# define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_TRACE
16
# else
17
# define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_INFO
18
# endif
19
#endif
20
21
#include <spdlog/spdlog.h>
22
23
#define MXL_TRACE(...) \
24
do \
25
{ \
26
try \
27
{ \
28
SPDLOG_TRACE(__VA_ARGS__); \
29
} \
30
catch (...) \
31
{} \
32
} \
33
while (false)
34
#define MXL_DEBUG(...) \
35
do \
36
{ \
37
try \
38
{ \
39
SPDLOG_DEBUG(__VA_ARGS__); \
40
} \
41
catch (...) \
42
{} \
43
} \
44
while (false)
45
#define MXL_INFO(...) \
46
do \
47
{ \
48
try \
49
{ \
50
SPDLOG_INFO(__VA_ARGS__); \
51
} \
52
catch (...) \
53
{} \
54
} \
55
while (false)
56
#define MXL_WARN(...) \
57
do \
58
{ \
59
try \
60
{ \
61
SPDLOG_WARN(__VA_ARGS__); \
62
} \
63
catch (...) \
64
{} \
65
} \
66
while (false)
67
#define MXL_ERROR(...) \
68
do \
69
{ \
70
try \
71
{ \
72
SPDLOG_ERROR(__VA_ARGS__); \
73
} \
74
catch (...) \
75
{} \
76
} \
77
while (false)
78
#define MXL_CRITICAL(...) \
79
do \
80
{ \
81
try \
82
{ \
83
SPDLOG_CRITICAL(__VA_ARGS__); \
84
} \
85
catch (...) \
86
{} \
87
} \
88
while (false)
lib
internal
include
mxl-internal
Logging.hpp
Generated by
1.15.0