GLS is designed with performance in mind. If GLS is disabled for a specific build (e.g., via Project Settings → Plugins → Game Logs System), all GLS subsystems remain inactive, ensuring that no GLS-specific logic or processing runs. This prevents any overhead in builds where GLS is not needed.
Additionally, the GLS_LOG
macro is designed to seamlessly redirect logs to the default UE_LOG
system if GLS subsystems are inactive. This ensures that log functionality remains intact while avoiding unnecessary processing by GLS.
Here’s how this is achieved:
- Subsystem Activation Check:
GLS subsystems are initialized only if GLS is enabled. If GLS is disabled, none of its subsystems (e.g.,UGLSSubsystem
) are activated, effectively bypassing all GLS-related code.
bool UGLSSubsystem::ShouldCreateSubsystem(UObject* Outer) const
{
return FGLSUtils::IsGLSEnabled();
}
- Macro Redirection:
TheGLS_LOG
macro checks subsystem status. If GLS is inactive, it directly redirects logs toUE_LOG
, ensuring minimal overhead.
#define GLS_LOG(CategoryName, Verbosity, Format, ...) \
if (FGLSUtils::IsGLSEnabled()) \
{ \
GLSSubsystem->Log(CategoryName, Verbosity, Format, ##__VA_ARGS__); \
}
else \
{ \
UE_LOG(CategoryName, Verbosity, Format, ##__VA_ARGS__); \
}
Thanks for the great question!