Maint: pass only single strings to logger methods

- Do not assume formatting from logger's interface
- Allow to change golibs in the future to accept only strings for logger methods
This commit is contained in:
Quentin McGaw (desktop)
2021-07-23 17:36:08 +00:00
parent 21f4cf7ab5
commit 3c44214d01
34 changed files with 134 additions and 127 deletions

View File

@@ -4,8 +4,6 @@ import (
"io"
"os"
"strings"
"github.com/qdm12/gluetun/internal/constants"
)
// WriteAuthFile writes the OpenVPN auth file to disk with the right permissions.
@@ -48,7 +46,7 @@ func (c *configurator) WriteAuthFile(user, password string, puid, pgid int) erro
return nil
}
c.logger.Info("username and password changed in %s", constants.OpenVPNAuthConf)
c.logger.Info("username and password changed in " + c.authFilePath)
file, err = os.OpenFile(c.authFilePath, os.O_TRUNC|os.O_WRONLY, 0400)
if err != nil {
return err

View File

@@ -247,7 +247,7 @@ func (l *looper) Run(ctx context.Context, done chan<- struct{}) {
func (l *looper) logAndWait(ctx context.Context, err error) {
if err != nil {
l.logger.Error(err)
l.logger.Error(err.Error())
}
l.logger.Info("retrying in " + l.backoffTime.String())
timer := time.NewTimer(l.backoffTime)

View File

@@ -16,7 +16,7 @@ func (c *configurator) CheckTUN() error {
return fmt.Errorf("TUN device is not available: %w", err)
}
if err := f.Close(); err != nil {
c.logger.Warn("Could not close TUN device file: %s", err)
c.logger.Warn("Could not close TUN device file: " + err.Error())
}
return nil
}