summaryrefslogtreecommitdiff
path: root/internal/io/dlog/loggers/factory.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/factory.go
parent7a7169791a64190e1002e38bc9c04ad0d5c1ce1f (diff)
vetting and linting and some code restyling
Diffstat (limited to 'internal/io/dlog/loggers/factory.go')
-rw-r--r--internal/io/dlog/loggers/factory.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/internal/io/dlog/loggers/factory.go b/internal/io/dlog/loggers/factory.go
index dda3ee6..415d7fb 100644
--- a/internal/io/dlog/loggers/factory.go
+++ b/internal/io/dlog/loggers/factory.go
@@ -9,11 +9,13 @@ import (
var factoryMap map[string]Logger
var factoryMutex sync.Mutex
+// Factory is there to retrieve a logger based on various settings.
func Factory(sourceName, loggerName string, rotationStrategy Strategy) Logger {
factoryMutex.Lock()
defer factoryMutex.Unlock()
- id := fmt.Sprintf("sourceName:%s,fileBase:%s,loggerName:%s", sourceName, rotationStrategy.FileBase, loggerName)
+ id := fmt.Sprintf("sourceName:%s,fileBase:%s,loggerName:%s", sourceName,
+ rotationStrategy.FileBase, loggerName)
if factoryMap == nil {
factoryMap = make(map[string]Logger)
}
@@ -36,10 +38,10 @@ func Factory(sourceName, loggerName string, rotationStrategy Strategy) Logger {
panic(fmt.Sprintf("Unsupported logger type '%s'", loggerName))
}
}
-
return singleton
}
+// FactoryRotate invokes a log rotation of all loggers.
func FactoryRotate() {
factoryMutex.Lock()
defer factoryMutex.Unlock()