Files
bssapp/svc/internal/auditlog/init.go
2026-02-11 17:46:22 +03:00

31 lines
483 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package auditlog
import (
"database/sql"
"log"
"sync"
)
var (
logQueue chan ActivityLog
dbConn *sql.DB
once sync.Once
)
// Init → main.go içinden çağrılacak (tek sefer)
func Init(db *sql.DB, bufferSize int) {
log.Println("🟢 auditlog Init called, buffer:", bufferSize)
dbConn = db
logQueue = make(chan ActivityLog, bufferSize)
go logWorker()
}
// Optional: app kapanırken flush/stop istersen
func Close() {
if logQueue != nil {
close(logQueue)
}
}