mattermost/server/public/pluginapi/audit.go
Ben Schumacher 45ec78b595
[MM-68457] Expose audit logging API via pluginapi.Client (#36232)
Co-authored-by: Mattermost Build <build@mattermost.com>
2026-04-28 13:42:12 +02:00

26 lines
764 B
Go

package pluginapi
import (
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/public/plugin"
"github.com/mattermost/mattermost/server/public/shared/mlog"
)
// AuditService exposes methods to emit audit records through the Mattermost server audit pipeline.
type AuditService struct {
api plugin.API
}
// Record logs an audit record using the default audit log level.
//
// Minimum server version: 10.10
func (a *AuditService) Record(rec *model.AuditRecord) {
a.api.LogAuditRec(rec)
}
// RecordWithLevel logs an audit record with the given log level.
//
// Minimum server version: 10.10
func (a *AuditService) RecordWithLevel(rec *model.AuditRecord, level mlog.Level) {
a.api.LogAuditRecWithLevel(rec, level)
}