mirror of
https://github.com/zeromicro/go-zero.git
synced 2025-01-24 01:30:25 +08:00
ac321fc146
* backup * simplify * chore: remove unused pool * chore: fix lint errors * chore: use strings.Builder instead of bytes.Buffer * test: add more tests * chore: fix reviewdog * test: fix data race * feat: make logger customizable * chore: fix reviewdog * test: fix fails * chore: fix set writer twice * chore: use context instead of golang.org context * chore: specify uint32 for level types
23 lines
329 B
Go
23 lines
329 B
Go
package logx
|
|
|
|
import "log"
|
|
|
|
type logWriter struct {
|
|
logger *log.Logger
|
|
}
|
|
|
|
func newLogWriter(logger *log.Logger) logWriter {
|
|
return logWriter{
|
|
logger: logger,
|
|
}
|
|
}
|
|
|
|
func (lw logWriter) Close() error {
|
|
return nil
|
|
}
|
|
|
|
func (lw logWriter) Write(data []byte) (int, error) {
|
|
lw.logger.Print(string(data))
|
|
return len(data), nil
|
|
}
|