https://github.com/botchris/go-auditrail
Simple audit trail implementation with interchangeable backends.
https://github.com/botchris/go-auditrail
Last synced: over 1 year ago
JSON representation
Simple audit trail implementation with interchangeable backends.
- Host: GitHub
- URL: https://github.com/botchris/go-auditrail
- Owner: botchris
- License: mit
- Created: 2024-10-20T22:12:15.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-07T11:05:55.000Z (over 1 year ago)
- Last Synced: 2025-01-30T18:30:50.227Z (over 1 year ago)
- Language: Go
- Size: 4.46 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go Auditrail
[](https://github.com/botchris/go-auditrail/actions/workflows/go-test.yml)
[](https://github.com/botchris/go-auditrail/actions/workflows/golangci-lint.yml)
Provides a simple interface for logging audit events in Go with support for multiple backends such as
file, Elasticsearch, and more.
## Installation
```bash
go get github.com/auditrail/go-auditrail
```
## Usage
```go
package main
import (
"context"
"fmt"
"os"
"github.com/botchris/go-auditrail"
)
func main() {
// Create a new client
client := auditrail.NewFileLogger(os.Stdout)
// Log a message
entry := auditrail.NewEntry("john", "order.deleted", "ordersService")
if err := client.Log(context.TODO(), entry); err != nil {
fmt.Println(err.Error())
}
}
```