Deluge Firmware 1.3.0
Build date: 2025.04.16
Loading...
Searching...
No Matches
log.h
1/*
2 * Copyright © 2015-2023 Synthstrom Audible Limited
3 *
4 * This file is part of The Synthstrom Audible Deluge Firmware.
5 *
6 * The Synthstrom Audible Deluge Firmware is free software: you can redistribute it and/or modify it under the
7 * terms of the GNU General Public License as published by the Free Software Foundation,
8 * either version 3 of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
11 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 * See the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along with this program.
15 * If not, see <https://www.gnu.org/licenses/>.
16 */
17#pragma once
18
19#include <cstddef>
20#include <cstring>
21#include <string> // IWYU pragma: export (these need to be included before printf.h redefines the strformat functions)
22
23#include "lib/printf.h" // IWYU pragma: export (non-allocating string formatting)
24
25#ifdef __cplusplus
26
27extern "C" {
28#endif
29// This is defined in display.cpp
30extern void freezeWithError(char const* errmsg);
31// this is defined in deluge.cpp
32enum DebugPrintMode { kDebugPrintModeDefault, kDebugPrintModeRaw, kDebugPrintModeNewlined };
33void logDebug(enum DebugPrintMode mode, const char* file, int line, size_t bufsize, const char* format, ...);
34#ifdef __cplusplus
35}
36#endif
37
38#if ENABLE_TEXT_OUTPUT
39#define D_PRINTLN(...) \
40 logDebug(kDebugPrintModeNewlined, __FILE__, __LINE__, 256, __VA_ARGS__) // NOLINT(cppcoreguidelines-pro-type-vararg)
41#define D_PRINT(...) \
42 logDebug(kDebugPrintModeDefault, __FILE__, __LINE__, 256, __VA_ARGS__) // NOLINT(cppcoreguidelines-pro-type-vararg)
43#define D_PRINT_RAW(...) \
44 logDebug(kDebugPrintModeRaw, __FILE__, __LINE__, 256, __VA_ARGS__) // NOLINT(cppcoreguidelines-pro-type-vararg)
45
46#else
47
48#define D_PRINTLN(...)
49#define D_PRINT(...)
50#define D_PRINT_RAW(...)
51#endif