UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
HierarchicalLogArchive.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
6#include "CoreMinimal.h"
7#include "HAL/Platform.h"
10
11class FArchive;
12
14{
15public:
17
19 {
21 : Ar(InAr)
22 {
23 if (Ar)
24 {
25 Ar->Indentation++;
26 }
27 }
28
30
32 : Ar(InOther.Ar)
33 {
34 InOther.Ar = nullptr;
35 }
36
38 {
39 if (Ar)
40 {
41 check(Ar->Indentation);
42 Ar->Indentation--;
43 }
44 }
45
47 };
48
49 void Print(const TCHAR* InLine)
50 {
51 WriteLine(InLine, false);
52 }
53
55 {
56 WriteLine(InLine, true);
57 return FIndentScope(this);
58 }
59
60 template <typename... Types>
62 {
63 WriteLine(FString::Printf(Fmt, Args...), false);
64 }
65
66 template <typename... Types>
68 {
69 WriteLine(FString::Printf(Fmt, Args...), true);
70 return FIndentScope(this);
71 }
72
73private:
74 CORE_API void WriteLine(const FString& InLine, bool bIndent = false);
75
76 int32 Indentation;
77};
78
79#if NO_LOGGING
80#define UE_SCOPED_INDENT_LOG_ARCHIVE(Code)
81#else
82#define UE_SCOPED_INDENT_LOG_ARCHIVE(Code) \
83 FHierarchicalLogArchive::FIndentScope BODY_MACRO_COMBINE(Scoped,Indent,_,__LINE__) = Code
84#endif
#define check(expr)
Definition AssertionMacros.h:314
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
Definition ArchiveProxy.h:19
Definition Archive.h:1208
Definition HierarchicalLogArchive.h:19
~FIndentScope()
Definition HierarchicalLogArchive.h:37
FIndentScope(FHierarchicalLogArchive *InAr=nullptr)
Definition HierarchicalLogArchive.h:20
FIndentScope(const FIndentScope &InOther)=delete
FIndentScope(FIndentScope &&InOther)
Definition HierarchicalLogArchive.h:31
FHierarchicalLogArchive * Ar
Definition HierarchicalLogArchive.h:46
Definition HierarchicalLogArchive.h:14
FIndentScope PrintfIndent(UE::Core::TCheckedFormatString< FString::FmtCharType, Types... > Fmt, Types... Args)
Definition HierarchicalLogArchive.h:67
void Printf(UE::Core::TCheckedFormatString< FString::FmtCharType, Types... > Fmt, Types... Args)
Definition HierarchicalLogArchive.h:61
FIndentScope PrintIndent(const TCHAR *InLine)
Definition HierarchicalLogArchive.h:54
void Print(const TCHAR *InLine)
Definition HierarchicalLogArchive.h:49