-
Notifications
You must be signed in to change notification settings - Fork 2
/
config_model.go
39 lines (33 loc) · 918 Bytes
/
config_model.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 kek
import (
"github.com/olehan/kek/config"
"github.com/olehan/kek/formatters"
)
type (
// LoggerConfig is logger specific set of configurations
// that also extends the default base configs.
LoggerConfig struct {
*config.Config
formatter formatters.Formatter
}
)
// NewLoggerConfig returns a new logger configuration.
func NewLoggerConfig(c *config.Config) *LoggerConfig {
return &LoggerConfig{
Config: c,
}
}
// SetFormatter sets logger formatter that will be used by printers.
func (l *LoggerConfig) SetFormatter(f formatters.Formatter) *LoggerConfig {
l.formatter = f
return l
}
// Value returns a value of the logger config pointer.
func (l *LoggerConfig) Value() LoggerConfig {
return *l
}
// Copy returns a new copy of the logger config pointer.
func (l *LoggerConfig) Copy() *LoggerConfig {
cp := l.Value()
return &cp
}