-
Notifications
You must be signed in to change notification settings - Fork 658
/
config.go
43 lines (36 loc) · 1.33 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// (c) 2019-2020, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package logging
import (
"fmt"
"time"
"github.com/mitchellh/go-homedir"
"github.com/ava-labs/avalanchego/utils/constants"
)
var (
// DefaultLogDirectory ...
DefaultLogDirectory = fmt.Sprintf("~/.%s/logs", constants.AppName)
)
// Config ...
type Config struct {
RotationInterval time.Duration
FileSize, RotationSize, FlushSize int
DisableLogging, DisableDisplaying, DisableContextualDisplaying, DisableFlushOnWrite, Assertions bool
LogLevel, DisplayLevel Level
DisplayHighlight Highlight
Directory, MsgPrefix string
}
// DefaultConfig ...
func DefaultConfig() (Config, error) {
dir, err := homedir.Expand(DefaultLogDirectory)
return Config{
RotationInterval: 24 * time.Hour,
FileSize: 1 << 23, // 8 MB
RotationSize: 7,
FlushSize: 1,
DisplayLevel: Info,
DisplayHighlight: Plain,
LogLevel: Debug,
Directory: dir,
}, err
}