feat(log): use github.com/qdm12/log library
This commit is contained in:
@@ -4,7 +4,7 @@ import (
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"github.com/qdm12/golibs/logging"
|
||||
"github.com/qdm12/log"
|
||||
"inet.af/netaddr"
|
||||
)
|
||||
|
||||
@@ -62,11 +62,11 @@ func CopyDurationPtr(original *time.Duration) (copied *time.Duration) {
|
||||
return copied
|
||||
}
|
||||
|
||||
func CopyLogLevelPtr(original *logging.Level) (copied *logging.Level) {
|
||||
func CopyLogLevelPtr(original *log.Level) (copied *log.Level) {
|
||||
if original == nil {
|
||||
return nil
|
||||
}
|
||||
copied = new(logging.Level)
|
||||
copied = new(log.Level)
|
||||
*copied = *original
|
||||
return copied
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"github.com/qdm12/golibs/logging"
|
||||
"github.com/qdm12/log"
|
||||
)
|
||||
|
||||
func DefaultInt(existing *int, defaultValue int) (
|
||||
@@ -74,12 +74,12 @@ func DefaultDuration(existing *time.Duration,
|
||||
return result
|
||||
}
|
||||
|
||||
func DefaultLogLevel(existing *logging.Level,
|
||||
defaultValue logging.Level) (result *logging.Level) {
|
||||
func DefaultLogLevel(existing *log.Level,
|
||||
defaultValue log.Level) (result *log.Level) {
|
||||
if existing != nil {
|
||||
return existing
|
||||
}
|
||||
result = new(logging.Level)
|
||||
result = new(log.Level)
|
||||
*result = defaultValue
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/qdm12/golibs/logging"
|
||||
"github.com/qdm12/log"
|
||||
"inet.af/netaddr"
|
||||
)
|
||||
|
||||
@@ -96,13 +96,13 @@ func MergeWithDuration(existing, other *time.Duration) (result *time.Duration) {
|
||||
return other
|
||||
}
|
||||
|
||||
func MergeWithLogLevel(existing, other *logging.Level) (result *logging.Level) {
|
||||
func MergeWithLogLevel(existing, other *log.Level) (result *log.Level) {
|
||||
if existing != nil {
|
||||
return existing
|
||||
} else if other == nil {
|
||||
return nil
|
||||
}
|
||||
result = new(logging.Level)
|
||||
result = new(log.Level)
|
||||
*result = *other
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/qdm12/golibs/logging"
|
||||
"github.com/qdm12/log"
|
||||
"inet.af/netaddr"
|
||||
)
|
||||
|
||||
@@ -86,11 +86,11 @@ func OverrideWithDuration(existing, other *time.Duration) (result *time.Duration
|
||||
return result
|
||||
}
|
||||
|
||||
func OverrideWithLogLevel(existing, other *logging.Level) (result *logging.Level) {
|
||||
func OverrideWithLogLevel(existing, other *log.Level) (result *log.Level) {
|
||||
if other == nil {
|
||||
return existing
|
||||
}
|
||||
result = new(logging.Level)
|
||||
result = new(log.Level)
|
||||
*result = *other
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -2,15 +2,15 @@ package settings
|
||||
|
||||
import (
|
||||
"github.com/qdm12/gluetun/internal/configuration/settings/helpers"
|
||||
"github.com/qdm12/golibs/logging"
|
||||
"github.com/qdm12/gotree"
|
||||
"github.com/qdm12/log"
|
||||
)
|
||||
|
||||
// Log contains settings to configure the logger.
|
||||
type Log struct {
|
||||
// Level is the log level of the logger.
|
||||
// It cannot be nil in the internal state.
|
||||
Level *logging.Level
|
||||
Level *log.Level
|
||||
}
|
||||
|
||||
func (l Log) validate() (err error) {
|
||||
@@ -37,7 +37,7 @@ func (l *Log) overrideWith(other Log) {
|
||||
}
|
||||
|
||||
func (l *Log) setDefaults() {
|
||||
l.Level = helpers.DefaultLogLevel(l.Level, logging.LevelInfo)
|
||||
l.Level = helpers.DefaultLogLevel(l.Level, log.LevelInfo)
|
||||
}
|
||||
|
||||
func (l Log) String() string {
|
||||
|
||||
Reference in New Issue
Block a user