autogits/bots-common/log.go

19 lines
319 B
Go
Raw Normal View History

2024-07-07 21:08:41 +02:00
package common
import (
"fmt"
"io"
2024-08-24 13:32:39 +02:00
"log"
2024-07-07 21:08:41 +02:00
)
var id uint
2024-08-24 13:32:39 +02:00
func CreateStdoutLogger(stdout, stderr io.Writer) (*log.Logger, *log.Logger) {
2024-07-07 21:08:41 +02:00
id++
2024-08-24 13:32:39 +02:00
idStr := fmt.Sprintf("[%d] ", id)
stdLogger := log.New(stdout, idStr, log.Lmsgprefix)
errLogger := log.New(stderr, idStr, log.Lmsgprefix)
return stdLogger, errLogger
2024-07-07 21:08:41 +02:00
}