Files
UnrealEngineUWP/Engine/Source/Programs/UnrealTraceServer/src/Logging.h
johan berg e4f390b1ac Break out logging and instance info
Prepare for future work by breaking out logging and instance info into separate files.

#rb ionut.matasaru

[CL 29987825 by johan berg in ue5-main branch]
2023-11-29 10:08:26 -05:00

37 lines
915 B
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Foundation.h"
////////////////////////////////////////////////////////////////////////////////
#define TS_LOG(Format, ...) \
do { FLogging::Log(Format "\n", ##__VA_ARGS__); } while (false)
////////////////////////////////////////////////////////////////////////////////
class FLogging
{
public:
static void Log(const char* Format, ...);
private:
friend struct FLoggingScope;
FLogging(FPath& Path);
~FLogging();
FLogging(const FLogging&) = delete;
FLogging(FLogging&&) = default;
void LogImpl(const char* String) const;
static FLogging* Instance;
FPath Path;
FILE* File = nullptr;
};
////////////////////////////////////////////////////////////////////////////////
struct FLoggingScope
{
FLoggingScope(FPath& Path, const char* LogFileName = nullptr);
~FLoggingScope();
private:
FLogging* PreviousScope = nullptr;
};