golem-logging-moonbit

Implements structured logging in MoonBit Golem agents using the wasi:logging API.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Developers building MoonBit agents on Golem need a consistent way to emit leveled, contextual log output that integrates with the platform's oplog and streaming tools, instead of relying on unstructured println statements.

Core Features & Use Cases

  • Module-Level Logging: Call @logging.info, @logging.debug, @logging.warn, and @logging.error directly with no initialization required.
  • Named Loggers with Context: Create scoped loggers via @logging.with_name("order-service") that build /-separated context strings passed to the WASI logging interface.
  • Level Filtering: Set a global minimum level with @logging.set_min_level or per-logger overrides with with_min_level to suppress noisy trace/debug output.
  • Use Case: While debugging a MoonBit order-processing agent, add a named logger per service module, set the global level to INFO in production, and stream live output with golem agent stream to trace failures.

Quick Start

Add logging to my MoonBit Golem agent using the @logging module with a named logger and info-level messages.

Frequently Asked Questions about golem-logging-moonbit

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

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

Use the @logging module from golemcloud/golem_sdk/logging, which is pre-imported in the template moon.pkg. Call module-level functions like @logging.info("message") or @logging.error("message") directly with no initialization required.

How do I create a named logger in MoonBit?

Create a named logger with @logging.with_name("order-service"), which returns an immutable Logger value. Chaining with_name appends /-separated segments to the context string passed to the WASI logging interface.

Does MoonBit println work for logging in Golem agents?

Yes, println output is captured as stdout and appears in golem agent stream output. However, it lacks log levels and context, so @logging is preferred for structured, filterable logging.

How do I filter log levels in a MoonBit agent?

Set a global minimum level with @logging.set_min_level(INFO) to suppress trace and debug output. Individual loggers can override this with logger.with_min_level(TRACE); otherwise they inherit the global minimum, which defaults to TRACE.

What happens to logs during Golem agent replay?

Logging is a side effect, so during replay after a crash, log calls from replayed operations are skipped. Logs are recorded in the oplog and remain visible via golem agent stream and golem agent invoke.