Installation
Requirements
Section titled “Requirements”- Go 1.26 or later
- samber/do v2 in your project
- An active Go module (
go.mod)
Install
Section titled “Install”go get github.com/larsartmann/samber-do-auditlogQuick Usage
Section titled “Quick Usage”package main
import ( "github.com/larsartmann/samber-do-auditlog" "github.com/samber/do/v2")
func main() { plugin, err := auditlog.New(auditlog.Config{ Enabled: true, ContainerID: "my-app", }) if err != nil { panic(err) }
injector := do.NewWithOpts(plugin.Opts())
// Register services as usual do.Provide(injector, func(i do.Injector) (*Database, error) { return &Database{}, nil })
// Export when ready plugin.ExportToHTML("audit.html")}Environment Variable
Section titled “Environment Variable”Control the plugin at runtime without code changes:
# Enable (default when Config.Enabled is true)DO_AUDITLOG_ENABLED=true
# Disable — zero hooks, zero costDO_AUDITLOG_ENABLED=falseWhen DO_AUDITLOG_ENABLED is set, it overrides Config.Enabled. This lets you enable auditing in development and disable it in production without recompiling.
Import
Section titled “Import”import "github.com/larsartmann/samber-do-auditlog"Verify Installation
Section titled “Verify Installation”go list -m github.com/larsartmann/samber-do-auditlogNext Steps
Section titled “Next Steps”- Follow the Quick Start for complete examples
- Learn about Export Formats to choose the right output
- See Dependency Tracking to understand graph inference