Start to add zap logger everywhere

This commit is contained in:
Ben Sarmiento
2023-11-05 00:02:22 +01:00
parent 4136310622
commit 1b116c2194
9 changed files with 204 additions and 50 deletions

View File

@@ -4,6 +4,7 @@ import (
"fmt"
"os"
"github.com/debridmediamanager.com/zurg/pkg/logutil"
"gopkg.in/yaml.v3"
)
@@ -19,10 +20,14 @@ type ConfigInterface interface {
MeetsConditions(directory, torrentID, torrentName string, fileNames []string) bool
GetOnLibraryUpdate() string
GetNetworkBufferSize() int
GetMountPath() string
GetMountPoint() string
}
func LoadZurgConfig(filename string) (ConfigInterface, error) {
rlog := logutil.NewLogger()
log := rlog.Named("config")
log.Debug("Loading config file", filename)
content, err := os.ReadFile(filename)
if err != nil {
return nil, err
@@ -35,6 +40,7 @@ func LoadZurgConfig(filename string) (ConfigInterface, error) {
switch initialConfig.Version {
case "v1":
log.Debug("Detected config version: v1")
return loadV1Config(content)
default: