summaryrefslogtreecommitdiff
path: root/client/client.go
diff options
context:
space:
mode:
authorJeroen Wijenbergh <jeroen.wijenbergh@geant.org>2025-08-01 15:10:41 +0200
committerJeroen Wijenbergh <jeroen.wijenbergh@geant.org>2025-08-25 14:40:18 +0200
commit5461efc826952833fcdecca5d3daa3ee70423a31 (patch)
tree0d9c71cf09f4a496d28f51409515ee6e79a24071 /client/client.go
parent08699e08d39675b76a9b813fd9fe41be6ab47a18 (diff)
Client + Log: Implement a log rotater
Diffstat (limited to 'client/client.go')
-rw-r--r--client/client.go13
1 files changed, 6 insertions, 7 deletions
diff --git a/client/client.go b/client/client.go
index 59b425d..793597a 100644
--- a/client/client.go
+++ b/client/client.go
@@ -8,7 +8,6 @@ import (
"errors"
"log/slog"
"net"
- "os"
"sync"
"time"
@@ -74,8 +73,8 @@ type Client struct {
// tokenCacher
tokCacher TokenCacher
- // logf is the log file
- logf *os.File
+ // logr is the log file rotater
+ logr *log.FileRotater
// cfg is the config
cfg *config.Config
@@ -162,11 +161,11 @@ func New(name string, version string, directory string, stateCallback func(FSMSt
lvl = slog.LevelDebug
}
- logf, err := log.Init(lvl, directory)
+ logr, err := log.Init(lvl, directory)
if err != nil {
return nil, i18nerr.WrapInternalf(err, "The log file with directory: '%s' failed to initialize", directory)
}
- c.logf = logf
+ c.logr = logr
// set client name
c.Name = name
@@ -293,8 +292,8 @@ func (c *Client) Deregister() {
}
// Close the log file
- if c.logf != nil {
- _ = c.logf.Close()
+ if c.logr != nil {
+ _ = c.logr.Close()
}
release()