Projekt for SPIE - Avatar for safety briefing / managment event
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

116 lines
4.3 KiB

// Copyright Voulz 2021-2025. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Runtime/Launch/Resources/Version.h"
DECLARE_LOG_CATEGORY_EXTERN(LogArchVisTools, Log, All);
#ifndef LOG
/**
* @brief Calls UE_LOG(CURRENT_LOG_CATEGORY, Display, ...). Make sure to define CURRENT_LOG_CATEGORY first with
* #define CURRENT_LOG_CATEGORY LogArchVisTools
*/
#define LOG(Format, ...) __LOG__(CURRENT_LOG_CATEGORY, Format, ##__VA_ARGS__);
#define __LOG__(LogCategory, Format, ...) UE_LOG(LogCategory, Display, TEXT(Format), ##__VA_ARGS__);
#endif
#ifndef LOG_H
/**
* @brief LOG + HERE. Calls UE_LOG(CURRENT_LOG_CATEGORY, Display, ...). Make sure to define CURRENT_LOG_CATEGORY first with
* #define CURRENT_LOG_CATEGORY LogArchVisToolsEditor
*/
#define LOG_H(Format, ...) __LOGH__(CURRENT_LOG_CATEGORY, Format, ##__VA_ARGS__);
#define __LOGH__(LogCategory, Format, ...) UE_LOG(LogCategory, Display, TEXT("[%hs] " Format), __FUNCTION__, ##__VA_ARGS__);
#endif
#ifndef LOGV
/**
* @brief Calls UE_LOG(CURRENT_LOG_CATEGORY, Log, ...). Make sure to define CURRENT_LOG_CATEGORY first with
* #define CURRENT_LOG_CATEGORY LogArchVisTools
*/
#define LOGV(Format, ...) __LOGV__(CURRENT_LOG_CATEGORY, Format, ##__VA_ARGS__);
#define __LOGV__(LogCategory, Format, ...) UE_LOG(LogCategory, Log, TEXT(Format), ##__VA_ARGS__);
#endif
#ifndef LOGV_H
/**
* @brief LOG VERBOSE + HERE. Calls UE_LOG(CURRENT_LOG_CATEGORY, Log, ...). Make sure to define CURRENT_LOG_CATEGORY first with
* #define CURRENT_LOG_CATEGORY LogArchVisToolsEditor
*/
#define LOGV_H(Format, ...) __LOGVH__(CURRENT_LOG_CATEGORY, Format, ##__VA_ARGS__);
#define __LOGVH__(LogCategory, Format, ...) UE_LOG(LogCategory, Log, TEXT("[%hs] " Format), __FUNCTION__, ##__VA_ARGS__);
#endif
#ifndef WARN
/**
* @brief Calls UE_LOG(CURRENT_LOG_CATEGORY, Warning, ...). Make sure to define CURRENT_LOG_CATEGORY first with
* #define CURRENT_LOG_CATEGORY LogArchVisTools
*/
#define WARN(Format, ...) __WARN__(CURRENT_LOG_CATEGORY, Format, ##__VA_ARGS__);
#define __WARN__(LogCategory, Format, ...) UE_LOG(LogCategory, Warning, TEXT(Format), ##__VA_ARGS__);
#endif
#ifndef WARN_H
/**
* @brief WARN + HERE. Calls UE_LOG(CURRENT_LOG_CATEGORY, Warning, ...). Make sure to define CURRENT_LOG_CATEGORY first with
* #define CURRENT_LOG_CATEGORY LogArchVisToolsEditor
*/
#define WARN_H(Format, ...) __WARNH__(CURRENT_LOG_CATEGORY, Format, ##__VA_ARGS__);
#define __WARNH__(LogCategory, Format, ...) UE_LOG(LogCategory, Warning, TEXT("[%hs] " Format), __FUNCTION__, ##__VA_ARGS__);
#endif
#ifndef ERROR
/**
* @brief Calls UE_LOG(CURRENT_LOG_CATEGORY, Error, ...). Make sure to define CURRENT_LOG_CATEGORY first with
* #define CURRENT_LOG_CATEGORY LogArchVisTools
*/
#define ERROR(Format, ...) __ERROR__(CURRENT_LOG_CATEGORY, Format, ##__VA_ARGS__);
#define __ERROR__(LogCategory, Format, ...) UE_LOG(LogCategory, Error, TEXT(Format), ##__VA_ARGS__);
#endif
#ifndef ERROR_H
/**
* @brief ERROR + HERE. Calls UE_LOG(CURRENT_LOG_CATEGORY, Error, ...). Make sure to define CURRENT_LOG_CATEGORY first with
* #define CURRENT_LOG_CATEGORY LogArchVisToolsEditor
*/
#define ERROR_H(Format, ...) __ERRORH__(CURRENT_LOG_CATEGORY, Format, ##__VA_ARGS__);
#define __ERRORH__(LogCategory, Format, ...) UE_LOG(LogCategory, Error, TEXT("[%hs] " Format), __FUNCTION__, ##__VA_ARGS__);
#endif
#ifndef __FILENAME__
/**
* @brief Returns the current Filename
*/
#define __FILENAME__ (wcsrchr(TEXT(__FILE__), '\\') ? wcsrchr(TEXT(__FILE__), '\\') + 1 : TEXT(__FILE__))
#endif
#ifndef WHERE
/**
* @brief Logs where this function has been called. Make sure to define CURRENT_LOG_CATEGORY first with
* #define CURRENT_LOG_CATEGORY LogArchVisTools
*/
#define WHERE LOG("%s - R%i - %hs", __FILENAME__, __LINE__, __FUNCTION__);
#endif
#ifndef HERE
/**
* @brief Prints the current function name in the Output. Make sure to define CURRENT_LOG_CATEGORY first with
* #define CURRENT_LOG_CATEGORY LogArchVisTools
*/
#define HERE LOGV(" ==== [%hs] ==== ", __FUNCTION__);
#endif
#ifndef BtoS
/**
* @brief Converts a bool to *CHAR for logging
*/
#define BtoS(var) var ? TEXT("True") : TEXT("False")
#endif
#define DEFINITION_FILE "ArchVisToolsDefinitions"
#pragma message(" [" DEFINITION_FILE "] COMPILING ON UE `" PREPROCESSOR_TO_STRING(ENGINE_MAJOR_VERSION) "`.`" PREPROCESSOR_TO_STRING(ENGINE_MINOR_VERSION) "`.`" PREPROCESSOR_TO_STRING(ENGINE_PATCH_VERSION) "`")
#undef DEFINITION_FILE