-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtext_impl.go
48 lines (40 loc) · 1.08 KB
/
text_impl.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
44
45
46
47
48
package log
import "log"
type textLogImpl struct {
*logOptions
log *log.Logger
}
// newTextLogImpl creates a new instance of text log implementation.
func newTextLogImpl(opts *logOptions) Log {
return &textLogImpl{
logOptions: opts,
log: log.New(opts.writer, ``, log.LstdFlags|log.Lmicroseconds),
}
}
// Log creates a new logger by extending the text logger implementation.
func (l *textLogImpl) Log(options ...Option) Logger {
opts := l.logOptions.copy()
opts.apply(options...)
return &logger{
logParser: logParser{
logOptions: opts,
log: l.log,
},
}
}
// SimpleLog creates a new simple logger by extending the text logger implementation.
// *Note: not implemented, will panic.
func (*textLogImpl) SimpleLog() SimpleLogger {
panic(`implement me`)
}
// PrefixedLog creates a new prefixed logger by extending the text logger implementation.
func (l *textLogImpl) PrefixedLog(options ...Option) PrefixedLogger {
opts := l.logOptions.copy()
opts.apply(options...)
return &prefixedLogger{
logParser: logParser{
logOptions: opts,
log: l.log,
},
}
}