summaryrefslogtreecommitdiff
path: root/internal/io/dlog/loggers/strategy.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2021-10-09 21:10:29 +0300
committerPaul Buetow <paul@buetow.org>2021-10-10 13:36:41 +0300
commit97747ea0f3178f7f5890512d483fdccaa82846b0 (patch)
tree9ff1335ca26afc90e55fd6de416457e252d75a35 /internal/io/dlog/loggers/strategy.go
parent7a7169791a64190e1002e38bc9c04ad0d5c1ce1f (diff)
vetting and linting and some code restyling
Diffstat (limited to 'internal/io/dlog/loggers/strategy.go')
-rw-r--r--internal/io/dlog/loggers/strategy.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/internal/io/dlog/loggers/strategy.go b/internal/io/dlog/loggers/strategy.go
index a1b9355..25d10f0 100644
--- a/internal/io/dlog/loggers/strategy.go
+++ b/internal/io/dlog/loggers/strategy.go
@@ -5,19 +5,26 @@ import (
"path/filepath"
)
+// Rotation is the actual strategy used for log rotation..
type Rotation int
const (
- DailyRotation Rotation = iota
+ // DailyRotation tells DTail to rotate its logs on a daily basis or on SIGHUP.
+ DailyRotation Rotation = iota
+ // SignalRotation tells DTail to rotate its logs only on SIGHUP.
SignalRotation Rotation = iota
)
+// Strategy is a pair of the rotation and the file base.
type Strategy struct {
+ // Rotation is the actual rotation strategy used.
Rotation Rotation
+ // FileBase can be a name (e.g. "dserver", "dmap") when signal rotation is used.
FileBase string
}
-func GetStrategy(name string) Strategy {
+// NewStrategy returns the stratey based on its name.
+func NewStrategy(name string) Strategy {
switch name {
case "daily":
return Strategy{DailyRotation, ""}