aboutsummaryrefslogtreecommitdiff
path: root/logger/logger.go
diff options
context:
space:
mode:
authorn-peugnet <n.peugnet@free.fr>2021-09-20 11:06:47 +0200
committern-peugnet <n.peugnet@free.fr>2021-09-20 11:44:32 +0200
commit81f191fdcd347df0b7ae52e061c9ab39e88bdbb1 (patch)
tree489fff15739ba095f75223b460bec48d034c06a6 /logger/logger.go
parent129032a13d19d500011fe23bcdd232b87eeb9b2f (diff)
downloaddna-backup-81f191fdcd347df0b7ae52e061c9ab39e88bdbb1.tar.gz
dna-backup-81f191fdcd347df0b7ae52e061c9ab39e88bdbb1.zip
store fileList compressed
for now using zlib on a 556Mo dir: files: 1469447 o -> 207289 o size divided by 7
Diffstat (limited to 'logger/logger.go')
-rw-r--r--logger/logger.go23
1 files changed, 11 insertions, 12 deletions
diff --git a/logger/logger.go b/logger/logger.go
index bc2b3c8..d6a8630 100644
--- a/logger/logger.go
+++ b/logger/logger.go
@@ -43,15 +43,19 @@ var (
defaultLogger *Logger
)
+func newLoggers() [4]logger {
+ return [4]logger{
+ log.New(os.Stderr, tagInfo, flags),
+ log.New(os.Stderr, tagWarning, flags),
+ log.New(os.Stderr, tagError, flags),
+ log.New(os.Stderr, tagFatal, flags),
+ }
+}
+
// initialize resets defaultLogger. Which allows tests to reset environment.
func initialize() {
defaultLogger = &Logger{
- loggers: [4]logger{
- log.New(os.Stderr, tagInfo, flags),
- log.New(os.Stderr, tagWarning, flags),
- log.New(os.Stderr, tagError, flags),
- log.New(os.Stderr, tagFatal, flags),
- },
+ loggers: newLoggers(),
minSeverity: 0,
}
}
@@ -68,12 +72,7 @@ func init() {
// logger.
func Init(level int) *Logger {
l := Logger{
- loggers: [4]logger{
- log.New(os.Stderr, tagInfo, flags),
- log.New(os.Stderr, tagWarning, flags),
- log.New(os.Stderr, tagError, flags),
- log.New(os.Stderr, tagFatal, flags),
- },
+ loggers: newLoggers(),
minSeverity: sFatal - severity(level),
initialized: true,
}