mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-10 03:47:03 +02:00
69c8a502db
* chore(deps): bump github.com/golangci/golangci-lint from 1.23.7 to 1.27.0 Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: tests Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
34 lines
626 B
Go
34 lines
626 B
Go
package logext
|
|
|
|
import "github.com/apex/log"
|
|
|
|
// Writer writes with log.Info.
|
|
type Writer struct {
|
|
ctx *log.Entry
|
|
}
|
|
|
|
// NewWriter creates a new log writer.
|
|
func NewWriter(ctx *log.Entry) Writer {
|
|
return Writer{ctx: ctx}
|
|
}
|
|
|
|
func (t Writer) Write(p []byte) (n int, err error) {
|
|
t.ctx.Info(string(p))
|
|
return len(p), nil
|
|
}
|
|
|
|
// Writer writes with log.Error.
|
|
type ErrorWriter struct {
|
|
ctx *log.Entry
|
|
}
|
|
|
|
// NewWriter creates a new log writer.
|
|
func NewErrWriter(ctx *log.Entry) ErrorWriter {
|
|
return ErrorWriter{ctx: ctx}
|
|
}
|
|
|
|
func (w ErrorWriter) Write(p []byte) (n int, err error) {
|
|
w.ctx.Error(string(p))
|
|
return len(p), nil
|
|
}
|