...
1 package fog
2
3 import (
4 "io"
5 "os"
6 )
7
8
9
10 func To(dest io.Writer) Option {
11 return func(o *options) {
12 o.dest = dest
13 }
14 }
15
16
17
18 func WithLevel(lvl int) Option {
19 return func(o *options) {
20 if lvl < 0 {
21 lvl = 2
22 }
23 o.lvl = int8(toZapLevel(lvl))
24 }
25 }
26
27
28
29 type options struct {
30 dest io.Writer
31 lvl int8
32 development bool
33 }
34
35 func makeOptions(opts ...Option) options {
36 o := options{dest: os.Stdout, development: false}
37 for _, opt := range opts {
38 opt(&o)
39 }
40
41 return o
42 }
43
44
45 func setDevelopment() Option {
46 return func(o *options) {
47 o.development = true
48 }
49 }
50
View as plain text