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文库

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

东风吹柳

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值