Changed LOG_ERROR signature to not require a condition
This commit is contained in:
@@ -1,3 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Komplex Wallpaper Engine
|
||||||
|
* Copyright (C) 2026 @DigitalArtifex
|
||||||
|
* https://digitalartifex.dev - https://github.com/DigitalArtifex
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
#ifndef LOGGING_H
|
#ifndef LOGGING_H
|
||||||
#define LOGGING_H
|
#define LOGGING_H
|
||||||
// clazy:exclude=clazy-unused-headers
|
// clazy:exclude=clazy-unused-headers
|
||||||
@@ -13,20 +31,27 @@
|
|||||||
* @param where
|
* @param where
|
||||||
* @param what
|
* @param what
|
||||||
*/
|
*/
|
||||||
#define LOG_ERROR(cond, where, what) \
|
#define LOG_ERROR(where, what) \
|
||||||
do { \
|
do { \
|
||||||
if ((cond)) { \
|
std::cerr << "Error Occurred:\n" \
|
||||||
std::cerr << "Assertion failed: (" << #cond << ")\n" \
|
|
||||||
<< " Location: " << (where) << "\n" \
|
<< " Location: " << (where) << "\n" \
|
||||||
<< " Message: " << (what) << "\n" \
|
<< " Message: " << (what) << "\n" \
|
||||||
<< " File: " << __FILE__ << ":" << __LINE__ << "\n"; \
|
<< " File: " << __FILE__ << ":" << __LINE__ << "\n"; \
|
||||||
} \
|
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief LOG_ERROR_X
|
||||||
|
*
|
||||||
|
* When cond is true, logs where and what as an error and returns the ret value
|
||||||
|
* @param cond
|
||||||
|
* @param where
|
||||||
|
* @param what
|
||||||
|
* @param ret
|
||||||
|
*/
|
||||||
#define LOG_ERROR_X(cond, where, what, ret) \
|
#define LOG_ERROR_X(cond, where, what, ret) \
|
||||||
do { \
|
do { \
|
||||||
if ((cond)) { \
|
if ((cond)) { \
|
||||||
std::cout << "Assertion failed: (" << #cond << ")\n" \
|
std::cerr << "Error Occurred: (" << #cond << ")\n" \
|
||||||
<< " Location: " << (where) << "\n" \
|
<< " Location: " << (where) << "\n" \
|
||||||
<< " Message: " << (what) << "\n" \
|
<< " Message: " << (what) << "\n" \
|
||||||
<< " File: " << __FILE__ << ":" << __LINE__ << "\n"; \
|
<< " File: " << __FILE__ << ":" << __LINE__ << "\n"; \
|
||||||
@@ -38,7 +63,7 @@
|
|||||||
#define ASSERT_X(cond, where, what) \
|
#define ASSERT_X(cond, where, what) \
|
||||||
do { \
|
do { \
|
||||||
if (!(cond)) { \
|
if (!(cond)) { \
|
||||||
std::cout << "Assertion failed: (" << #cond << ")\n" \
|
std::cerr << "Assertion failed: (" << #cond << ")\n" \
|
||||||
<< " Location: " << (where) << "\n" \
|
<< " Location: " << (where) << "\n" \
|
||||||
<< " Message: " << (what) << "\n" \
|
<< " Message: " << (what) << "\n" \
|
||||||
<< " File: " << __FILE__ << ":" << __LINE__ << "\n"; \
|
<< " File: " << __FILE__ << ":" << __LINE__ << "\n"; \
|
||||||
|
|||||||
Reference in New Issue
Block a user