AgentSkillsCN

logging

仅适用于高级日志记录与调试场景。

SKILL.md
--- frontmatter
name: logging
description: Only for advanced logging/debugging use cases

Debugging and Logging

Because the client constantly resimulates frames, the client log is usually filled with duplicate messages. This makes print-debugging difficult.

Recommended Approaches

  1. Look at server logs - Usually the simplest solution for gameplay debugging
  2. Use Game.is_predicted_frame() - Returns false for resimulated frames
csl
// Only logs once per frame, not during resimulation
if Game.is_predicted_frame() {
    log_info("Player position: %", {player.entity.world_position});
}

Note: Game.is_predicted_frame() always returns true on the server.

When to Use Each Approach

Debugging TargetApproach
Gameplay logicCheck server logs
Local-only cosmeticsUse is_predicted_frame() check
Client-server disagreementsCompare both logs