logs
OCaml Logs library patterns for structured logging. Use when Claude needs to: (1) Add logging to OCaml modules, (2) Create per-module log sources, (3) Use appropriate log levels, (4) Add structured tags to log messages
Unsigned, install at your own risk
UnverifiedThis skill has no cryptographic signature attached. We can't verify the contents match what the publisher intended.
Install this skill
No account required. Pick your tool, or use the command that detects it for you.
Run in your terminal. It detects your AI tool.
npx @skills-hub-ai/cli install ocaml-dev-logsManual setup by platform
Claude Code
~/.claude/skills/ocaml-dev-logs/SKILL.md
Instructions
OCaml Logs Patterns
The logs library provides structured logging with per-module sources.
Module Setup
Every module that logs should create its own source:
let log_src = Logs.Src.create "project.module_name"
module Log = (val Logs.src_log log_src : Logs.LOG)
This is the standard idiom. Do NOT attempt to abstract or deduplicate this boilerplate.
Log Levels
| Level | Function | Use Case |
|---|---|---|
| App | Log.app | Always shown to user (startup, completion) |
| Error | Log.err | Handled but critical errors |
| Warning | Log.warn | Potential issues, operation continues |
| Info | Log.info | State transitions, progress |
| Debug | Log.debug | Verbose debugging details |
Basic Logging
Log.info (fun m -> m "Processing %d items" count);
Log.err (fun m -> m "Failed to connect: %s" reason);
Log.debug (fun m -> m "Request: %a" Request.pp req)
Structured Tags
Add context with tags for filtering/analysis:
Log.info (fun m ->
m "Event received: %s" event_type
~tags:(Logs.Tag.add "channel_id" channel Logs.Tag.empty))
Reporter Setup (bin/)
In CLI applications, set up the reporter in bin/common.ml:
let setup_log style_renderer level =
Fmt_tty.setup_std_outputs ?style_renderer ();
Logs.set_level level;
Logs.set_reporter (Logs_fmt.reporter ())
open Cmdliner
let setup_log =
Term.(const setup_log
$ Fmt_cli.style_renderer ()
$ Logs_cli.level ())
Security
Reviews (0)
Related skills
Browse all →More from OCaml Dev (avsm)
View source →More Build skills
Browse category →Frequently asked questions about logs
What does the logs skill do?
OCaml Logs library patterns for structured logging. Use when Claude needs to: (1) Add logging to OCaml modules, (2) Create per-module log sources, (3) Use appropriate log levels, (4) Add structured tags to log messages It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.
How do I install the logs skill?
Run `npx @skills-hub-ai/cli install ocaml-dev-logs` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/ocaml-dev-logs/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.
Which AI tools does logs work with?
logs runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.
Is the logs skill free?
Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.
How do I use logs after installing it?
In Claude Code, type `/ocaml-dev-logs` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.
Can I share the logs skill with my team?
Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.