UE4/UE5 日志插件(基于spdlog)

1 解决问题

对于高频日志序列化到本地的需求,spdlog肯定完美满足。

源码地址:https://github.com/gabime/spdlog

博主下载的版本为 spdlog-1.12.0,各位大佬可以根绝自己爱好选择。

2 过程介绍

大概目录:

SpdlogLibC目录下是对spdlog的封装:

bin里是.dll,lib放是.lib,include是.h文件。

SpdLoggerLib.Build.cs文件内容:

// Copyright Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;
using System.IO;


public class SpdLoggerLib : ModuleRules
{
	private string OuterLibPath
	{
		get { return Path.GetFullPath(Path.Combine(ModuleDirectory, "SpdlogLibC/")); }
	}

	public SpdLoggerLib(ReadOnlyTargetRules Target) : base(Target)
	{
		PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;


		PublicIncludePaths.AddRange(
			new string[] { 
			
			}
			);

		PrivateIncludePaths.AddRange(
			new string[] {
				// ... add other private include paths required here ...
			}
			);
			
		
		PublicDependencyModuleNames.AddRange(
			new string[]
			{
				"Core",
				"Projects"
				// ... add other public dependencies that you statically link with here ...
			}
			);
			
		
		PrivateDependencyModuleNames.AddRange(
			new string[]
			{
				"CoreUObject",
				"Engine",
				"InputCore"// ... add private dependencies that you statically link with here ...	
			}
			);
		
		
		DynamicallyLoadedModuleNames.AddRange(
			new string[]
			{
				// ... add any modules that your module loads dynamically here ...
			}
			);

		if (Target.Platform == UnrealTargetPlatform.Win64)
		{
			string LibPath = OuterLibPath + "lib/x64/";
			string DllPath = OuterLibPath + "bin/x64/";
			string IncludePath = OuterLibPath + "include/";

			PublicSystemIncludePaths.AddRange(
				new string[] {
					IncludePath
				}
				);
			foreach (string file in Directory.GetFiles(LibPath))
			{
				PublicAdditionalLibraries.Add(file);
			}
			foreach (string file in Directory.GetFiles(DllPath))
			{
				string filename = Path.GetFileName(file);
				string outdll = "$(TargetOutputDir)/";
				outdll += filename;
				RuntimeDependencies.Add(outdll, file);
			}
		}
		else if (Target.Platform == UnrealTargetPlatform.Mac) { }
		else if (Target.Platform == UnrealTargetPlatform.Linux) { }
	}
}

3 使用简介

将插件拷贝到您的项目插件目录下:

蓝图里直接使用:

产生的日志在您的项目content根目录下:

4 插件特点

  • 屏蔽大量实现细节,只暴露一个接口到蓝图;
  • 足够高效,继承了spdlog的多线程、高并发;
  • 封装的原生dll库不区分debug和release,实用性更广。

5 下载地址

UE4/5高并发日志插件资源-CSDN文库

相关推荐

  1. UE5.1_AssetEditorSubsystem&UE4_AssetEditorManager

    2023-12-19 00:56:02       34 阅读

最近更新

  1. TCP协议是安全的吗?

    2023-12-19 00:56:02       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2023-12-19 00:56:02       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2023-12-19 00:56:02       19 阅读
  4. 通过文章id递归查询所有评论(xml)

    2023-12-19 00:56:02       20 阅读

热门阅读

  1. 前后端传参格式

    2023-12-19 00:56:02       37 阅读
  2. 低代码冲击带来的影响

    2023-12-19 00:56:02       43 阅读
  3. Windows Hypervisor Platform魔改版Unicorn Engine

    2023-12-19 00:56:02       38 阅读
  4. 深度学习epoch、psnr、epoch、step解释

    2023-12-19 00:56:02       35 阅读