logging-and-assertions

Add structured logging and runtime assertions to Unreal Engine C++ code.

1|Updated Sep 6, 2026
One-click install
npx skills add https://github.com/ziyarduc/Baran-bk-game --skill logging-and-assertions-ziyarduc
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: logging-and-assertions
Source: https://github.com/ziyarduc/Baran-bk-game/tree/main/.agents/skills/logging-and-assertions
Command: npx skills add https://github.com/ziyarduc/Baran-bk-game --skill logging-and-assertions-ziyarduc

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Unreal C++ bugs are hard to diagnose without proper diagnostics. This Skill guides you through defining custom log categories, choosing the right verbosity level, using structured logging with UE_LOGFMT, and picking the correct assertion macro (check vs verify vs ensure) so failures are caught early and logs stay scannable. ## Core Features & Use Cases - Custom Log Categories: Declare and define per-module log categories with DECLARE_LOG_CATEGORY_EXTERN/DEFINE_LOG_CATEGORY, including file-private and class-static variants. - Structured Logging: Use UE_LOGFMT with positional or named fields, UE_LOG_CONTEXT thread-local scopes, and custom SerializeForLog overloads for machine-readable output. - Assertion Selection: Choose between check (halts, compiled out in shipping), verify (expression always runs), and ensure (non-fatal, reports once) based on whether continuing is safe. - Use Case: When adding diagnostics to a new gameplay module, define a dedicated log category, emit UE_LOGFMT events with named fields for weapon fire and damage, and guard nullable pointers with ensure so the editor stays alive during PIE debugging. ## Quick Start Ask the assistant to add a custom log category and appropriate check/ensure assertions to your Unreal C++ gameplay class.

Frequently Asked Questions about logging-and-assertions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a custom log category in Unreal Engine C++?▼

Declare the category in a header with DECLARE_LOG_CATEGORY_EXTERN(LogMyModule, Log, All) and define it once in a .cpp file with DEFINE_LOG_CATEGORY(LogMyModule). For a single-file category, use DEFINE_LOG_CATEGORY_STATIC with no header declaration.

What is the difference between check, verify, and ensure in Unreal Engine?▼

check halts execution and is compiled out in shipping builds. verify also halts in development but its expression still evaluates in shipping. ensure is non-fatal: it logs a callstack once per call site and lets execution continue, making it preferred for gameplay code.

How do I use UE_LOGFMT structured logging in Unreal Engine?▼

Include Logging/StructuredLog.h, then call UE_LOGFMT with a format string containing {Field} placeholders and either positional values or named ("Field", Value) pairs. Field names must match [A-Za-z0-9_]+ and be unique within the call.

Why does my UE_LOG with %s print garbage for an FString?▼

The %s specifier expects a const TCHAR*, not an FString object. Passing an FString directly as a vararg reads garbage bytes. Always dereference the FString with the * operator, as in *MyString, when passing it to UE_LOG.

Does check() run in Unreal Engine shipping builds?▼

No. When DO_CHECK is 0 in shipping builds, check(expr) compiles to nothing and the expression is never evaluated. If the expression has required side effects, use verify instead, or enable USE_CHECKS_IN_SHIPPING for debugging shipping-only crashes.

How do I change log verbosity at runtime in Unreal Engine?▼

Open the in-game console and run Log CategoryName Verbosity, for example Log LogMyModule Verbose. You can also pass -LogCmds="LogMyModule Verbose" on the command line, but runtime levels cannot exceed the category's compile-time maximum.