-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
39 lines (33 loc) · 1.16 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
package loghive
import (
"github.com/sirupsen/logrus"
"time"
)
// LogFormat describes how internal logs will be formatted
type LogFormat string
// LogFormatJSON will print JSON logs
const LogFormatJSON LogFormat = "json"
// LogFormatLogfmt will print Logfmt logs
const LogFormatLogfmt LogFormat = "logfmt"
// DefaultConfig is the default configuration, which will be written to the config database if a config is not found
var DefaultConfig = Config{
InternalLogLevel: logrus.InfoLevel,
InternalLogFormat: LogFormatLogfmt,
WritableDomains: []string{"_"},
SegmentMaxDuration: time.Duration(336) * time.Hour, // 336/24=14 days
SegmentMaxBytes: 128 * 1024 * 1024, // 128 MiB
LineMaxBytes: 8 * 1024, // 8 KiB
FlushAfterItems: 128,
FlushAfterDuration: time.Duration(1000) * time.Millisecond,
}
// Config describes the configuration that Loghive needs to function
type Config struct {
InternalLogLevel logrus.Level
InternalLogFormat LogFormat
WritableDomains []string
SegmentMaxDuration time.Duration
SegmentMaxBytes int64
LineMaxBytes int
FlushAfterItems int
FlushAfterDuration time.Duration
}