mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-02-03 22:18:39 +00:00
By adding a logger field to "prog" struct, and use this field inside its method instead of always accessing global mainLog variable. This at least ensure more consistent usage of the logger during ctrld prog runtime, and also help refactoring the code more easily in the future (like replacing the logger library).
34 lines
778 B
Go
34 lines
778 B
Go
package cli
|
|
|
|
import "github.com/rs/zerolog"
|
|
|
|
// Debug starts a new message with debug level.
|
|
func (p *prog) Debug() *zerolog.Event {
|
|
return p.logger.Load().Debug()
|
|
}
|
|
|
|
// Warn starts a new message with warn level.
|
|
func (p *prog) Warn() *zerolog.Event {
|
|
return p.logger.Load().Warn()
|
|
}
|
|
|
|
// Info starts a new message with info level.
|
|
func (p *prog) Info() *zerolog.Event {
|
|
return p.logger.Load().Info()
|
|
}
|
|
|
|
// Fatal starts a new message with fatal level.
|
|
func (p *prog) Fatal() *zerolog.Event {
|
|
return p.logger.Load().Fatal()
|
|
}
|
|
|
|
// Error starts a new message with error level.
|
|
func (p *prog) Error() *zerolog.Event {
|
|
return p.logger.Load().Error()
|
|
}
|
|
|
|
// Notice starts a new message with notice level.
|
|
func (p *prog) Notice() *zerolog.Event {
|
|
return p.logger.Load().Notice()
|
|
}
|