audit-observer

command
v1.0.42 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2026 License: MIT Imports: 6 Imported by: 0

README

Example: audit observer

The simplest possible lark-cli plugin: one After observer that logs every dispatched command to stderr (success or failure).

Build & run

cd extension/platform/examples/audit-observer
go build -o audit-cli .
./audit-cli config plugins show
# {"plugins":[{"name":"audit", ...}], "total":1}

./audit-cli api GET /open-apis/contact/v3/users/me
# [audit] api ok            (on stderr)

Key points

  • platform.NewPlugin(...).MustBuild() from init(). The blank import of this package in main.go triggers init().
  • Observer(platform.After, ...) runs after the command's RunE, even on failure (Observers cannot prevent execution).
  • FailOpen() means: if Install ever fails, the binary logs a warning and continues without this plugin. Right default for audit-only plugins.

Documentation

Overview

Command audit-observer is a runnable fork of lark-cli that logs every dispatched command to stderr. Demonstrates the simplest possible plugin: one After observer matching All commands.

Build & run:

cd extension/platform/examples/audit-observer
go build -o audit-cli .
./audit-cli config plugins show     # see "audit" in the list
./audit-cli api GET /open-apis/...  # observer logs to stderr

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL