3#include "CoreGlobals.h"
4#include "Misc/OutputDevice.h"
5#include "Misc/UObjectToken.h"
6#include "Misc/FeedbackContext.h"
7#include "GameFramework/PlayerController.h"
8#include "Engine/Engine.h"
9#include "Logging/MessageLog.h"
11#if WITH_UNREAL_DEVELOPER_TOOLS
12#include "MessageLogInitializationOptions.h"
13#include "MessageLogModule.h"
16#include "Modules/ModuleManager.h"
18#if ENGINE_MINOR_VERSION >= 24
19 #define NY_ARRAY_COUNT UE_ARRAY_COUNT
21 #define NY_ARRAY_COUNT ARRAY_COUNT
28#define NY_GROWABLE_LOGF(SerializeFunc) \
29 int32 BufferSize = 1024; \
30 TCHAR* Buffer = NULL; \
33 TCHAR StackBuffer[512]; \
34 TCHAR* AllocatedBuffer = NULL; \
37 Buffer = StackBuffer; \
38 GET_VARARGS_RESULT( Buffer, NY_ARRAY_COUNT(StackBuffer), NY_ARRAY_COUNT(StackBuffer) - 1, Fmt, Fmt, Result ); \
43 FMemory::SystemFree(AllocatedBuffer); \
45 Buffer = AllocatedBuffer = (TCHAR*) FMemory::SystemMalloc( BufferSize * sizeof(TCHAR) ); \
46 GET_VARARGS_RESULT( Buffer, BufferSize, BufferSize-1, Fmt, Fmt, Result ); \
53 FMemory::SystemFree(AllocatedBuffer);
82#if WITH_UNREAL_DEVELOPER_TOOLS
83FMessageLogModule* INYLogger::GetMessageLogModule()
85 return FModuleManager::LoadModulePtr<FMessageLogModule>(
"MessageLog");
91#if WITH_UNREAL_DEVELOPER_TOOLS
92 FMessageLogModule* MessageLogModule = GetMessageLogModule();
93 if (!MessageLogModule)
98 return MessageLogModule->IsRegisteredLogListing(LogName);
106#if WITH_UNREAL_DEVELOPER_TOOLS
107 FMessageLogModule* MessageLogModule = GetMessageLogModule();
108 if (!MessageLogModule)
113 FMessageLogInitializationOptions UnrealInitOptions;
114 UnrealInitOptions.bShowFilters = InitOptions.
bShowFilters;
115 UnrealInitOptions.bShowPages = InitOptions.
bShowPages;
116 UnrealInitOptions.bAllowClear = InitOptions.
bAllowClear;
118 UnrealInitOptions.MaxPageCount = InitOptions.
MaxPageCount;
121 MessageLogModule->RegisterLogListing(LogName, LogLabel, UnrealInitOptions);
127#if WITH_UNREAL_DEVELOPER_TOOLS
128 FMessageLogModule* MessageLogModule = GetMessageLogModule();
129 if (!MessageLogModule)
134 return MessageLogModule->UnregisterLogListing(LogName);
140#if WITH_UNREAL_DEVELOPER_TOOLS
141TSharedPtr<IMessageLogListing> INYLogger::MessageLogGetLogNameListing(FName LogName)
143 FMessageLogModule* MessageLogModule = GetMessageLogModule();
144 if (!MessageLogModule)
149 return MessageLogModule->GetLogListing(LogName);
155#if WITH_UNREAL_DEVELOPER_TOOLS
156 FMessageLogModule* MessageLogModule = GetMessageLogModule();
157 if (!MessageLogModule)
162 MessageLogModule->OpenMessageLog(LogName);
229 const uint64 Key = INDEX_NONE;
247 const FName Type = NAME_None;
248 const float LifetimeSeconds = 0.f;
270 MessageLog.Message(Severity, FText::FromString(Message));
275 MessageLog.Open(Severity,
false);
299 GEngine->ClearOnScreenDebugMessages();
#define NY_GROWABLE_LOGF(SerializeFunc)
ENYLoggerLogLevel OpenMessageLogLevelsHigherThan
FORCEINLINE bool IsOnScreenEnabled() const
float ScreenLogDisplayTimeSeconds
virtual void LogOutputLog(ENYLoggerLogLevel Level, const FString &Message)
static FOutputDevice * GetOutputDeviceFromLogLevel(ENYLoggerLogLevel Level)
static bool IsMessageLogNameRegistered(FName LogName)
FORCEINLINE bool IsMessageLogEnabled() const
FORCEINLINE bool IsClientConsoleEnabled() const
FColor GetColorForLogLevel(ENYLoggerLogLevel Level) const
FVector2D ScreenTextScale
virtual void LogScreen(ENYLoggerLogLevel Level, const FString &Message)
static FORCEINLINE void EnableAllOnScreenMessages()
ENYLoggerLogLevel RedirectMessageLogLevelsHigherThan
void Log(ENYLoggerLogLevel Level, const FString &Message)
virtual void LogClientConsole(ENYLoggerLogLevel Level, const FString &Message)
Self & SetClientConsolePlayerController(APlayerController *PC)
static void MessageLogOpenLogName(FName LogName)
bool bForceEnableScreenMessages
static EMessageSeverity::Type GetMessageSeverityForLogLevel(ENYLoggerLogLevel Level)
static FORCEINLINE void SetAreAllOnScreenMessagesEnabled(bool bValue)
static void MessageLogRegisterLogName(FName LogName, const FText &LogLabel, const FNYMessageLogInitializationOptions &InitOptions={})
void VARARGS LogfImplementation(ENYLoggerLogLevel Level, const TCHAR *Fmt,...)
static void ClearAllOnScreenLogs()
static FORCEINLINE bool AreAllOnScreenMessagesEnabled()
APlayerController * PlayerController
virtual void LogMessageLog(ENYLoggerLogLevel Level, const FString &Message)
bool bMessageLogMirrorToOutputLog
FORCEINLINE bool IsOutputLogEnabled() const
static bool MessageLogUnregisterLogName(FName LogName)
static ELogVerbosity::Type GetUnrealLogTypeForLogLevel(ENYLoggerLogLevel Level)
bool bDiscardDuplicates
Whether to check for duplicate messages & discard them.