Help us shape the future of Go! Take the 2026 Go Developer Survey

audit

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package audit 审计日志:对敏感操作留结构化审计痕迹,与业务日志分离。 字段值统一经 logredact 打码——审计载荷常含平台 token、连接串、Bearer 头。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action string

Action 审计操作类型(调用方按需扩展)。

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger 审计日志器。

func New

func New(log logx.Logger, service string) *Logger

New 创建审计日志器。service 用于日志前缀(如 "argus-audit")。 log 为 nil 时回退到 logx.NewAuditLogger(v0.5.1 起门面级承诺:级别锁 Info、 不受 LOG_LEVEL 降级、SetLevel 调到 WARN/ERROR 被拒、With* 派生保持守卫)—— 审计留痕不随业务日志级别配置丢失。

func (*Logger) Log

func (l *Logger) Log(action Action, fields ...any)

Log 记录一条审计事件(nil receiver 安全)。字符串字段值经 logredact.Redact 打码。

Jump to

Keyboard shortcuts

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