Documentation ¶
Index ¶
- func SLogger(name string) *zap.SugaredLogger
- func Setup(opts ...option) error
- func Sync()
- func WithColorLevel(on bool) option
- func WithErrorLogPath(p string) option
- func WithJSONEncoding(on bool) option
- func WithLevel(lvl Level) option
- func WithMode(mode Mode) option
- func WithPath(p string) option
- func WithRotate(on bool) option
- func WithStackTrace(on bool, lvl Level) option
- func WithStdout(on bool) option
- type Level
- type Mode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SLogger ¶
func SLogger(name string) *zap.SugaredLogger
func WithColorLevel ¶
func WithColorLevel(on bool) option
WithColorLevel set color on log levels. Only applied to stdout and non-JSON encoder.
Why: color in json and diskfile makes it hard to parse for
logging system, it's only for human readablility.
func WithErrorLogPath ¶
func WithErrorLogPath(p string) option
WithErrorLogPath set log file on ERROR logs
func WithJSONEncoding ¶
func WithJSONEncoding(on bool) option
WithJSONEncoding encode log format in JSON.
func WithRotate ¶
func WithRotate(on bool) option
WithRotate setup log file rotate on default settings.
func WithStackTrace ¶
WithStackTrace enable stack trace that log level >= lvl
func WithStdout ¶
func WithStdout(on bool) option
WithStdout send log to stdout even the log path already set.
Types ¶
type Level ¶
type Level int8
A Level is a logging priority. Higher levels are more important.
const ( // same to zap's levels, but only keep 4 levels of them DebugLevel Level = iota - 1 // InfoLevel is the default logging priority. InfoLevel // WarnLevel logs are more important than Info, but don't need individual // human review. WarnLevel // ErrorLevel logs are high-priority. If an application is running smoothly, // it shouldn't generate any error-level logs. ErrorLevel )
Click to show internal directories.
Click to hide internal directories.