Using WithPrefix for loggers
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
||||
)
|
||||
|
||||
func (c *configurator) Start() (stdout io.ReadCloser, waitFn func() error, err error) {
|
||||
c.logger.Info("%s: starting tinyproxy server", logPrefix)
|
||||
c.logger.Info("starting tinyproxy server")
|
||||
stdout, _, waitFn, err = c.commander.Start("tinyproxy", "-d")
|
||||
return stdout, waitFn, err
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
func (c *configurator) MakeConf(logLevel models.TinyProxyLogLevel, port uint16, user, password string, uid, gid int) error {
|
||||
c.logger.Info("%s: generating tinyproxy configuration file", logPrefix)
|
||||
c.logger.Info("generating tinyproxy configuration file")
|
||||
lines := generateConf(logLevel, port, user, password, uid, gid)
|
||||
return c.fileManager.WriteLinesToFile(string(constants.TinyProxyConf),
|
||||
lines,
|
||||
|
||||
@@ -9,8 +9,6 @@ import (
|
||||
"github.com/qdm12/private-internet-access-docker/internal/models"
|
||||
)
|
||||
|
||||
const logPrefix = "tinyproxy configurator"
|
||||
|
||||
type Configurator interface {
|
||||
Version() (string, error)
|
||||
MakeConf(logLevel models.TinyProxyLogLevel, port uint16, user, password string, uid, gid int) error
|
||||
@@ -24,5 +22,8 @@ type configurator struct {
|
||||
}
|
||||
|
||||
func NewConfigurator(fileManager files.FileManager, logger logging.Logger) Configurator {
|
||||
return &configurator{fileManager, logger, command.NewCommander()}
|
||||
return &configurator{
|
||||
fileManager: fileManager,
|
||||
logger: logger.WithPrefix("tinyproxy configurator: "),
|
||||
commander: command.NewCommander()}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user