mirror of
https://github.com/number571/go-peer.git
synced 2026-09-12 19:50:00 +05:00
42 lines
616 B
Go
42 lines
616 B
Go
package logger
|
|
|
|
import (
|
|
"io"
|
|
)
|
|
|
|
var (
|
|
_ ISettings = &sSettings{}
|
|
)
|
|
|
|
type SSettings sSettings
|
|
type sSettings struct {
|
|
FInfo io.Writer
|
|
FWarn io.Writer
|
|
FErro io.Writer
|
|
}
|
|
|
|
func NewSettings(pSett *SSettings) ISettings {
|
|
return (&sSettings{
|
|
FInfo: pSett.FInfo,
|
|
FWarn: pSett.FWarn,
|
|
FErro: pSett.FErro,
|
|
}).mustNotNull()
|
|
}
|
|
|
|
func (p *sSettings) mustNotNull() ISettings {
|
|
// set nil for void fields
|
|
return p
|
|
}
|
|
|
|
func (p *sSettings) GetInfoWriter() io.Writer {
|
|
return p.FInfo
|
|
}
|
|
|
|
func (p *sSettings) GetWarnWriter() io.Writer {
|
|
return p.FWarn
|
|
}
|
|
|
|
func (p *sSettings) GetErroWriter() io.Writer {
|
|
return p.FErro
|
|
}
|