|
1 | | - |
2 | 1 | package zap |
3 | 2 |
|
4 | 3 | import ( |
5 | 4 | "time" |
| 5 | + |
| 6 | + "go.uber.org/zap" |
6 | 7 | ) |
7 | 8 |
|
8 | 9 | // Config contains the configuration options for the logger. To create a Config |
9 | 10 | // from a common.Config use logp/config.Build. |
10 | 11 | type Config struct { |
11 | | - Name string `config:",ignore"` // Name of the Logger (for default file name). |
12 | | - JSON bool `config:"json"` // Write logs as JSON. |
13 | | - Level Level `config:"level"` // Logging level (error, warning, info, debug). |
14 | | - Selectors []string `config:"selectors"` // Selectors for debug level logging. |
15 | | - |
16 | | - ToStderr bool `config:"to_stderr"` |
17 | | - ToSyslog bool `config:"to_syslog"` |
18 | | - ToFiles bool `config:"to_files"` |
19 | | - ToEventLog bool `config:"to_eventlog"` |
| 12 | + Name string // Name of the Logger (for default file name). |
| 13 | + JSON bool // Write logs as JSON. |
| 14 | + Level Level // Logging level (error, warning, info, debug). |
| 15 | + Metas []zap.Field // Root Logger Metas |
| 16 | + Selectors []string // Selectors for debug level logging. |
| 17 | + |
| 18 | + ToStderr bool |
| 19 | + ToSyslog bool |
| 20 | + ToFiles bool |
| 21 | + ToEventLog bool |
20 | 22 | toObserver bool |
21 | 23 | toIODiscard bool |
22 | 24 |
|
23 | | - Files FileConfig `config:"files"` |
| 25 | + Files FileConfig |
24 | 26 |
|
25 | 27 | addCaller bool // Adds package and line number info to messages. |
26 | 28 | development bool // Controls how DPanic behaves. |
27 | 29 | } |
28 | 30 |
|
29 | 31 | // FileConfig contains the configuration options for the file output. |
30 | 32 | type FileConfig struct { |
31 | | - Path string `config:"path"` |
32 | | - Name string `config:"name"` |
33 | | - MaxSize uint `config:"rotateeverybytes" validate:"min=1"` |
34 | | - MaxBackups uint `config:"keepfiles" validate:"max=1024"` |
35 | | - Permissions uint32 `config:"permissions"` |
36 | | - Interval time.Duration `config:"interval"` |
37 | | - RotateOnStartup bool `config:"rotateonstartup"` |
38 | | - RedirectStderr bool `config:"redirect_stderr"` |
| 33 | + Path string |
| 34 | + Name string |
| 35 | + MaxSize uint |
| 36 | + MaxBackups uint |
| 37 | + Permissions uint32 |
| 38 | + Interval time.Duration |
| 39 | + RotateOnStartup bool |
| 40 | + RedirectStderr bool |
39 | 41 | } |
40 | 42 |
|
41 | 43 | var defaultConfig = Config{ |
|
0 commit comments