-`ServiceName`: set the service name, optional. on `volume` mode, the name is used to generate the log files. Within `rest/zrpc` services, the name will be set to the name of `rest` or `zrpc` automatically.
-`Mode`: the mode to output the logs, default is `console`.
-`console` mode writes the logs to `stdout/stderr`.
-`file` mode writes the logs to the files specified by `Path`.
-`volume` mode is used in docker, to write logs into mounted volumes.
-`Encoding`: indicates how to encode the logs, default is `json`.
-`json` mode writes the logs in json format.
-`plain` mode writes the logs with plain text, with terminal color enabled.
-`TimeFormat`: customize the time format, optional. Default is `2006-01-02T15:04:05.000Z07:00`.
-`Path`: set the log path, default to `logs`.
-`Level`: the logging level to filter logs. Default is `info`.
-`info`, all logs are written.
-`error`, `info` logs are suppressed.
-`severe`, `info` and `error` logs are suppressed, only `severe` logs are written.
-`Compress`: whether or not to compress log files, only works with `file` mode.
-`KeepDays`: how many days that the log files are kept, after the given days, the outdated files will be deleted automatically. It has no effect on `console` mode.
-`StackCooldownMillis`: how many milliseconds to rewrite stacktrace again. It’s used to avoid stacktrace flooding.
## Logging methods
```go
type Logger interface {
// Error logs a message at error level.
Error(...interface{})
// Errorf logs a message at error level.
Errorf(string, ...interface{})
// Errorv logs a message at error level.
Errorv(interface{})
// Errorw logs a message at error level.
Errorw(string, ...LogField)
// Info logs a message at info level.
Info(...interface{})
// Infof logs a message at info level.
Infof(string, ...interface{})
// Infov logs a message at info level.
Infov(interface{})
// Infow logs a message at info level.
Infow(string, ...LogField)
// Slow logs a message at slow level.
Slow(...interface{})
// Slowf logs a message at slow level.
Slowf(string, ...interface{})
// Slowv logs a message at slow level.
Slowv(interface{})
// Sloww logs a message at slow level.
Sloww(string, ...LogField)
// WithContext returns a new logger with the given context.
WithContext(context.Context) Logger
// WithDuration returns a new logger with the given duration.
WithDuration(time.Duration) Logger
}
```
-`Error`, `Info`, `Slow`: write any kind of messages into logs, with like `fmt.Sprint(…)`.
-`Errorf`, `Infof`, `Slowf`: write messages with given format into logs.
-`Errorv`, `Infov`, `Slowv`: write any kind of messages into logs, with json marshalling to encode them.
-`Errorw`, `Infow`, `Sloww`: write the string message with given `key:value` fields.
-`WithContext`: inject the given ctx into the log messages, typically used to log `trace-id` and `span-id`.
-`WithDuration`: write elapsed duration into the log messages, with key `duration`.