Skip to content

Commit b3b7fd0

Browse files
vgramermjuraga
authored andcommitted
BUG/MINOR: configuration: fix missing logs during configuration loading
the logger is not initalized yet, so warnning messages were lost Signed-off-by: Vincent Gramer <[email protected]>
1 parent acfe533 commit b3b7fd0

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

configuration/configuration.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,10 @@ import (
2020
"errors"
2121
"fmt"
2222
"io/fs"
23-
"math/rand"
2423
"os"
2524
"path/filepath"
2625
"strings"
2726
"sync"
28-
"time"
2927

3028
petname "github.com/dustinkirkland/golang-petname"
3129
"github.com/haproxytech/client-native/v4/models"
@@ -226,7 +224,7 @@ func (c *Configuration) Load() error {
226224
}
227225
if err = c.storage.Load(c.HAProxy.DataplaneConfig); err != nil {
228226
if errors.Is(err, fs.ErrNotExist) {
229-
log.Warningf("configuration file %s does not exists, creating one", c.HAProxy.DataplaneConfig)
227+
fmt.Printf("configuration file %s does not exists, creating one\n", c.HAProxy.DataplaneConfig)
230228
} else {
231229
return fmt.Errorf("configuration file %s not valid: %w", c.HAProxy.DataplaneConfig, err)
232230
}
@@ -245,8 +243,7 @@ func (c *Configuration) Load() error {
245243
if c.Name.Load() == "" {
246244
hostname, nameErr := os.Hostname()
247245
if nameErr != nil {
248-
log.Warningf("Error fetching hostname, using petname for dataplaneapi name: %s", nameErr.Error())
249-
rand.Seed(time.Now().UnixNano())
246+
fmt.Printf("Error fetching hostname, using petname for dataplaneapi name: %s\n", nameErr.Error())
250247
c.Name.Store(petname.Generate(2, "_"))
251248
}
252249
c.Name.Store(hostname)

0 commit comments

Comments
 (0)