feat: init audit logger with default logger (#2369)
This commit is contained in:
parent
1a5b999545
commit
935259387a
13
audit/audit.go
Normal file
13
audit/audit.go
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package audit
|
||||||
|
|
||||||
|
import "log"
|
||||||
|
|
||||||
|
var auditLogger *log.Logger
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
setupAuditLogger()
|
||||||
|
}
|
||||||
|
|
||||||
|
func setupAuditLogger() {
|
||||||
|
auditLogger = log.Default()
|
||||||
|
}
|
||||||
16
audit/audit_test.go
Normal file
16
audit/audit_test.go
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
package audit
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestSetupAuditLogger(t *testing.T) {
|
||||||
|
auditLogger = nil
|
||||||
|
|
||||||
|
setupAuditLogger()
|
||||||
|
|
||||||
|
if auditLogger != log.Default() {
|
||||||
|
t.Error("Audit logger isn't set to the default logger!")
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user