MCPcopy
hub / github.com/andeya/pholcus / SetLogger

Method SetLogger

logs/logs/log.go:143–158  ·  view source on GitHub ↗

SetLogger provides a given logger adapter into BeeLogger with config string.

(adapterName string, config map[string]interface{})

Source from the content-addressed store, hash-verified

141
142// SetLogger provides a given logger adapter into BeeLogger with config string.
143func (bl *BeeLogger) SetLogger(adapterName string, config map[string]interface{}) error {
144 bl.lock.Lock()
145 defer bl.lock.Unlock()
146 if log, ok := adapters[adapterName]; ok {
147 lg := log()
148 err := lg.Init(config)
149 bl.outputs[adapterName] = lg
150 if err != nil {
151 fmt.Println("logs.BeeLogger.SetLogger: " + err.Error())
152 return err
153 }
154 } else {
155 return fmt.Errorf("logs: unknown adapterName %q (forgotten Register?)", adapterName)
156 }
157 return nil
158}
159
160// remove a logger adapter in BeeLogger.
161func (bl *BeeLogger) DelLogger(adapterName string) error {

Callers

nothing calls this directly

Calls 2

InitMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected