uniugm/admin/lib/xlog/handler/handler_stream.go

29 lines
451 B
Go
Raw Normal View History

2025-04-18 17:17:23 +08:00
package handler
import "io"
// StreamHandler writes logs to a specified io Writer, maybe stdout, stderr, etc...
type StreamHandler struct {
w io.Writer
}
func NewStreamHandler(w io.Writer) (*StreamHandler, error) {
h := new(StreamHandler)
h.w = w
return h, nil
}
func (h *StreamHandler) Rotate() {
}
func (h *StreamHandler) Write(b []byte) (n int, err error) {
return h.w.Write(b)
}
func (h *StreamHandler) Close() error {
return nil
}