golem-logging-rust

Adds structured logging to Rust Golem agents using the log crate.

1.5k|212|Updated Nov 24, 2023
One-click install
npx skills add https://github.com/golemcloud/golem --skill golem-logging-rust
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golem-logging-rust
Source: https://github.com/golemcloud/golem/tree/main/golem-skills/skills/rust/golem-logging-rust
Command: npx skills add https://github.com/golemcloud/golem --skill golem-logging-rust

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Rust developers building Golem agents need a consistent way to emit debug, info, and error output that is captured by the platform and visible during development and debugging, without writing any logger initialization code.

Core Features & Use Cases

  • Standard log crate macros: Use log::trace!, log::debug!, log::info!, log::warn!, and log::error! with no setup, since the golem-rust SDK initializes the logger automatically at agent startup.
  • Structured key-value logging: Attach contextual key-value pairs (e.g., agent_id, operation) to log records via the log crate's kv feature, enabled by default in the template Cargo.toml.
  • Live log streaming: View stdout, stderr, and log output with golem agent stream or during golem agent invoke.
  • Use Case: While debugging a counter agent, add log::info!(agent_id = self.name, count = self.count; "counter incremented") and run golem agent stream to watch structured output in real time.

Quick Start

Add log macros to my Rust Golem agent and show me how to stream the agent's logs with the golem CLI.

Frequently Asked Questions about golem-logging-rust

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

FAQPage Schema
How do I add logging to a Rust Golem agent?

Use the standard log crate macros such as log::info!, log::debug!, and log::error! directly in your agent code. The golem-rust SDK initializes the logger automatically at agent startup, so no setup code is required.

How do I view logs from a Golem agent?

Run golem agent stream '<agent-id>' to see live stdout, stderr, and log output. Logs also stream automatically during golem agent invoke unless you pass the --no-stream flag.

Does the log crate support structured key-value logging in Golem?

Yes, the log crate's kv feature is enabled by default in the template Cargo.toml. Pass key-value pairs before a semicolon, for example log::info!(agent_id = self.name; "counter incremented").

Should I use println! or the log crate in a Golem agent?

Prefer the log crate macros because they provide log levels and structured context that are filterable. println! and eprintln! output is still captured by Golem and visible in agent streams, but lacks levels and metadata.

Why are my log messages missing during agent replay?

Logging is a side effect recorded in the oplog, so during replay after a crash, log calls from replayed operations are skipped. Only new invocations produce fresh log output.