diff options
| author | Paul Buetow <paul@buetow.org> | 2021-10-02 11:23:08 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2021-10-02 12:26:36 +0300 |
| commit | 6e1af993924bc7bebe898b403962db5a6b3505d1 (patch) | |
| tree | e4f124dfc917bc96a669e8598400775b2ca5fc25 /internal/io/dlog/loggers | |
| parent | 764ef99a3d779a0db1fb60679292af52425ba2f6 (diff) | |
Client default log dir is ~/log
Diffstat (limited to 'internal/io/dlog/loggers')
| -rw-r--r-- | internal/io/dlog/loggers/strategy.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/internal/io/dlog/loggers/strategy.go b/internal/io/dlog/loggers/strategy.go new file mode 100644 index 0000000..a1b9355 --- /dev/null +++ b/internal/io/dlog/loggers/strategy.go @@ -0,0 +1,27 @@ +package loggers + +import ( + "os" + "path/filepath" +) + +type Rotation int + +const ( + DailyRotation Rotation = iota + SignalRotation Rotation = iota +) + +type Strategy struct { + Rotation Rotation + FileBase string +} + +func GetStrategy(name string) Strategy { + switch name { + case "daily": + return Strategy{DailyRotation, ""} + default: + return Strategy{SignalRotation, filepath.Base(os.Args[0])} + } +} |
