autogits/bots-common/log.go
2024-08-24 13:32:39 +02:00

19 lines
319 B
Go

package common
import (
"fmt"
"io"
"log"
)
var id uint
func CreateStdoutLogger(stdout, stderr io.Writer) (*log.Logger, *log.Logger) {
id++
idStr := fmt.Sprintf("[%d] ", id)
stdLogger := log.New(stdout, idStr, log.Lmsgprefix)
errLogger := log.New(stderr, idStr, log.Lmsgprefix)
return stdLogger, errLogger
}