summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2021-10-11 17:42:37 +0300
committerPaul Buetow <paul@buetow.org>2021-10-12 22:35:56 +0300
commita6098084f7150df34edecf1519386bd28a527361 (patch)
tree8c81477d0b6ef1f5934f012eb5bd05462bbb7c16 /internal
parentc0f4ebc9b3773c37e22c686024c8cc7ce4e71f9f (diff)
Update JSON-schema to reflect all recent config file changes.
Diffstat (limited to 'internal')
-rw-r--r--internal/config/client.go2
-rw-r--r--internal/config/common.go9
-rw-r--r--internal/config/server.go2
-rw-r--r--internal/io/dlog/dlog.go4
-rw-r--r--internal/io/dlog/loggers/factory.go8
5 files changed, 11 insertions, 14 deletions
diff --git a/internal/config/client.go b/internal/config/client.go
index 8227c68..9f4df97 100644
--- a/internal/config/client.go
+++ b/internal/config/client.go
@@ -102,7 +102,7 @@ type termColors struct {
// ClientConfig represents a DTail client configuration (empty as of now as there
// are no available config options yet, but that may changes in the future).
type ClientConfig struct {
- TermColorsEnable bool
+ TermColorsEnable bool `json:",omitempty"`
TermColors termColors `json:",omitempty"`
}
diff --git a/internal/config/common.go b/internal/config/common.go
index 9d22c95..7a72cfe 100644
--- a/internal/config/common.go
+++ b/internal/config/common.go
@@ -12,12 +12,10 @@ type CommonConfig struct {
Logger string
// LogLevel defines how much is logged.
LogLevel string `json:",omitempty"`
- // LogStrategy defines the log rotation strategy.
- LogStrategy string
+ // LogRotation strategy to be used.
+ LogRotation string
// The cache directory
CacheDir string
- // The temp directory
- TmpDir string `json:",omitempty"`
}
// Create a new default configuration.
@@ -28,8 +26,7 @@ func newDefaultCommonConfig() *CommonConfig {
LogDir: "log",
Logger: "stdout",
LogLevel: DefaultLogLevel,
- LogStrategy: "daily",
+ LogRotation: "daily",
CacheDir: "cache",
- TmpDir: "/tmp",
}
}
diff --git a/internal/config/server.go b/internal/config/server.go
index 677f5ac..254ea0c 100644
--- a/internal/config/server.go
+++ b/internal/config/server.go
@@ -47,7 +47,7 @@ type ServerConfig struct {
MaxConcurrentCats int
// The max amount of concurrent tails per server.
MaxConcurrentTails int
- // The user permissions.
+ // The user permissions. TODO: Add to JSON schema
Permissions Permissions `json:",omitempty"`
// The mapr log format
MapreduceLogFormat string `json:",omitempty"`
diff --git a/internal/io/dlog/dlog.go b/internal/io/dlog/dlog.go
index da67585..5e0c3a1 100644
--- a/internal/io/dlog/dlog.go
+++ b/internal/io/dlog/dlog.go
@@ -82,12 +82,12 @@ func new(sourceProcess, sourcePackage source.Source) *DLog {
if err != nil {
panic(err)
}
- strategy := loggers.NewStrategy(config.Common.LogStrategy)
+ logRotation := loggers.NewStrategy(config.Common.LogRotation)
loggerName := config.Common.Logger
level := newLevel(config.Common.LogLevel)
return &DLog{
- logger: loggers.Factory(sourceProcess.String(), loggerName, strategy),
+ logger: loggers.Factory(sourceProcess.String(), loggerName, logRotation),
sourceProcess: sourceProcess,
sourcePackage: sourcePackage,
maxLevel: level,
diff --git a/internal/io/dlog/loggers/factory.go b/internal/io/dlog/loggers/factory.go
index 415d7fb..a5cc7cf 100644
--- a/internal/io/dlog/loggers/factory.go
+++ b/internal/io/dlog/loggers/factory.go
@@ -10,12 +10,12 @@ 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 {
+func Factory(sourceName, loggerName string, logRotation Strategy) Logger {
factoryMutex.Lock()
defer factoryMutex.Unlock()
id := fmt.Sprintf("sourceName:%s,fileBase:%s,loggerName:%s", sourceName,
- rotationStrategy.FileBase, loggerName)
+ logRotation.FileBase, loggerName)
if factoryMap == nil {
factoryMap = make(map[string]Logger)
}
@@ -29,10 +29,10 @@ func Factory(sourceName, loggerName string, rotationStrategy Strategy) Logger {
singleton = newStdout()
factoryMap[id] = singleton
case "file":
- singleton = newFile(rotationStrategy)
+ singleton = newFile(logRotation)
factoryMap[id] = singleton
case "fout":
- singleton = newFout(rotationStrategy)
+ singleton = newFout(logRotation)
factoryMap[id] = singleton
default:
panic(fmt.Sprintf("Unsupported logger type '%s'", loggerName))