Files
cflmy 9331af78e2 release(2.8.0): 合入 CHANGELOG/README/发版说明/skills prove 任务;CI 链接指向 doc/releases
- CHANGELOG.md:v2.8.0 条目(中英双语);
- README.md:版本行 2.7.1→2.8.0 + 愿景第 6 条(知识可证明);
- doc/releases/v2.8.0.md:双语发版说明(亮点/用法/已知限制);
- skills/marqdo-dev/index.mq.md:新增 prove 任务(路径/目录模式/
  require_lean/json;参数用 + 行声明升参,check 与 narrative-ratio 通过);
- 设计文档 §12.5 标记已合入;发版链接统一指向 doc/releases/v2.8.0.md。
2026-11-18 10:29:26 +08:00

4.2 KiB
Executable File

markup, title, description
markup title description
occlusion lib/log Level-filtered one-line logs (Mid M6 + Mid2 M10 fields). Default level info.

Level-filtered one-line logs (Mid M6 + Mid2 M10 fields). Default level info.

Emit level-filtered diagnostic lines.

Behavior and limits: set_level changes this run only. Logs are side effects, not return values. call captures stdout separately from its JSON result.

This single source file is the usage and development manual. Import it directly, or use marqdo call with a function heading below. Parameter tables give types and defaults; required parameters must be supplied. Return tables are progressive contracts; prose describes failure and limits.

Implementation: src/host/log.rs

For development, keep EN/ZH behavior aligned and compose public libraries first. Add host primitives only at OS or algorithm boundaries and declare their effects. Run marqdo check --narrative-ratio on this file and the real workflows in tests/stdlib_tasks.rs after edits.

set_level

参数 类型 默认 说明
level any required Log threshold: debug, info, warn or error
返回 类型 说明
result any level is debug / info / warn / error

Use level as the inputs for this operation.

Effects: pure.

level is debug / info / warn / error.

Return [level is debug / info / warn / error](> host_log_set_level level=level).

debug

参数 类型 默认 说明
text text required Text supplied by the caller
fields any None Structured field/value record attached to the log event
返回 类型 说明
result any Emit a debug log line; optional fields map

Use text, fields=None as the inputs for this operation.

Effects: output.write.

Emit a debug log line; optional fields map.

We retain line = [Log line]([Emit a debug log line; optional fields map](host_log_line(level="debug", text=text, fields=fields))).

  1. line We Print the prepared message.

Return None.

info

参数 类型 默认 说明
text text required Text supplied by the caller
fields any None Structured field/value record attached to the log event
返回 类型 说明
result any Emit an info log line; optional fields map

Use text, fields=None as the inputs for this operation.

Effects: output.write.

Call this function directly:

marqdo call lib/log.mq.md info 'text="handbook example"' 'fields={"task":"sample"}' --effects output.write --json

Emit an info log line; optional fields map.

We retain line = [Log line]([Emit an info log line; optional fields map](host_log_line(level="info", text=text, fields=fields))).

  1. line We Print the prepared message.

Return None.

warn

参数 类型 默认 说明
text text required Text supplied by the caller
fields any None Structured field/value record attached to the log event
返回 类型 说明
result any Emit a warn log line; optional fields map

Use text, fields=None as the inputs for this operation.

Effects: output.write.

Emit a warn log line; optional fields map.

We retain line = [Log line]([Emit a warn log line; optional fields map](host_log_line(level="warn", text=text, fields=fields))).

  1. line We Print the prepared message.

Return None.

error

参数 类型 默认 说明
text text required Text supplied by the caller
fields any None Structured field/value record attached to the log event
返回 类型 说明
result any Emit an error log line; optional fields map

Use text, fields=None as the inputs for this operation.

Effects: output.write.

Emit an error log line; optional fields map.

We retain line = [Log line]([Emit an error log line; optional fields map](host_log_line(level="error", text=text, fields=fields))).

  1. line We Print the prepared message.

Return None.