2023-02-28 01:15:26 +00:00
|
|
|
// AUTOGENERATED COPYRIGHT HEADER START
|
|
|
|
// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
|
|
|
|
// AUTOGENERATED COPYRIGHT HEADER END
|
2020-11-08 05:47:47 +00:00
|
|
|
|
|
|
|
#pragma once
|
2022-08-29 10:29:44 +00:00
|
|
|
#include "warning-disable.hpp"
|
2020-11-08 05:47:47 +00:00
|
|
|
#include <cinttypes>
|
|
|
|
#include <cstdint>
|
2022-08-29 10:29:44 +00:00
|
|
|
#include "warning-enable.hpp"
|
2020-11-08 05:47:47 +00:00
|
|
|
|
2021-06-08 02:18:02 +00:00
|
|
|
#define P_LOG(...) streamfx::util::logging::log(__VA_ARGS__);
|
|
|
|
#define P_LOG_ERROR(...) P_LOG(streamfx::util::logging::level::LEVEL_ERROR, __VA_ARGS__)
|
|
|
|
#define P_LOG_WARN(...) P_LOG(streamfx::util::logging::level::LEVEL_WARN, __VA_ARGS__)
|
|
|
|
#define P_LOG_INFO(...) P_LOG(streamfx::util::logging::level::LEVEL_INFO, __VA_ARGS__)
|
2020-11-08 05:47:47 +00:00
|
|
|
#ifdef _DEBUG
|
2021-06-08 02:18:02 +00:00
|
|
|
#define P_LOG_DEBUG(...) P_LOG(streamfx::util::logging::level::LEVEL_DEBUG, __VA_ARGS__)
|
2020-11-08 05:47:47 +00:00
|
|
|
#else
|
|
|
|
#define P_LOG_DEBUG(...)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Function/Class/Struct Name
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
// Microsoft Visual Studio
|
|
|
|
#define __FUNCTION_SIG__ __FUNCSIG__
|
|
|
|
#define __FUNCTION_NAME__ __func__
|
|
|
|
#elif defined(__GNUC__) || defined(__MINGW32__)
|
|
|
|
// GCC and MinGW
|
|
|
|
#define __FUNCTION_SIG__ __PRETTY_FUNCTION__
|
|
|
|
#define __FUNCTION_NAME__ __func__
|
|
|
|
#else
|
|
|
|
// Any other compiler
|
|
|
|
#define __FUNCTION_SIG__ __func__
|
|
|
|
#define __FUNCTION_NAME__ __func__
|
|
|
|
#endif
|
|
|
|
|
2021-06-08 02:18:02 +00:00
|
|
|
namespace streamfx::util::logging {
|
2020-11-08 05:47:47 +00:00
|
|
|
enum class level {
|
|
|
|
LEVEL_DEBUG, // Debug information, which is not necessary to know at runtime.
|
2023-05-13 12:35:46 +00:00
|
|
|
LEVEL_INFO, // Runtime information, which may or may not be needed for support.
|
|
|
|
LEVEL_WARN, // Warnings, which should be respected and fixed.
|
2020-11-08 05:47:47 +00:00
|
|
|
LEVEL_ERROR, // Errors that must be fixed.
|
|
|
|
};
|
|
|
|
|
|
|
|
void log(level lvl, const char* format, ...);
|
2021-06-08 02:18:02 +00:00
|
|
|
} // namespace streamfx::util::logging
|