English | 简体中文
- Download logger for Go by using
go get -u github.com/niubir/logger- Constructing a logger object
import "github.com/niubir/logger"
logger := logger.NewLogger()- Use
logger.Debug("This Debug")
logger.Info("This Info")
logger.Warning("This Warning")
logger.Error("This Error")| Option | Default | Description |
|---|---|---|
| WithTime | - | log with time(Use golang time layout) |
| SetLevel | Info | log level(Debug Info Warning Error Fatal) |
| WithStack | false | log stack |
| WithStdout | false | log with os.Stdout |
| WithFileout | false | log with file |
| WithFileout.WithFilePath | ./ | log file path |
| WithFileout.WithFilePrefix | - | log file prefix |
| WithFileout.WithFileDuration | 365 day | log file duration |
| WithFileout.WithFileMaxByte | 1024 | log file max byte |