Documentation ¶
Index ¶
- Constants
- func Close()
- func Debug() *zerolog.Event
- func Error() *zerolog.Event
- func Fatal() *zerolog.Event
- func File(filename string, c FileConfig, l levels) zerolog.LevelWriter
- func GetHttpWriter(method string, endpoint string, l levels) zerolog.LevelWriter
- func GetLogger() zerolog.Logger
- func Info() *zerolog.Event
- func InitLogger(writers ...zerolog.LevelWriter) error
- func New(writers ...zerolog.LevelWriter) (zlog, error)
- func NewLevels(lvls ...zerolog.Level) levels
- func Panic() *zerolog.Event
- func PrintWriterError(format string, a ...interface{})
- func Sentry(sentryConf SentryConfig, flushTimeout time.Duration, lvls levels) zerolog.LevelWriter
- func SentryFromClient(sentryClient *sentry.Client, flushTimeout time.Duration, lvls levels) zerolog.LevelWriter
- func SentryWithHub(sentryConf SentryConfig, flushTimeout time.Duration, lvls levels) zerolog.LevelWriter
- func SetTimeFieldFormat(format string)
- func SkipSentry() *zerolog.Logger
- func StdErr(l levels) zerolog.LevelWriter
- func StdOut(l levels) zerolog.LevelWriter
- func Trace() *zerolog.Event
- func Warn() *zerolog.Event
- type FileConfig
- type HttpWriter
- type LevelWriter
- type SentryConfig
- type SentryWriter
- type WriterError
Constants ¶
View Source
const ( // DebugLevel defines debug log level. DebugLevel = zerolog.DebugLevel // InfoLevel defines info log level. InfoLevel = zerolog.InfoLevel // WarnLevel defines warn log level. WarnLevel = zerolog.WarnLevel // ErrorLevel defines error log level. ErrorLevel = zerolog.ErrorLevel // FatalLevel defines fatal log level. FatalLevel = zerolog.FatalLevel // PanicLevel defines panic log level. PanicLevel = zerolog.PanicLevel // NoLevel defines an absent log level. NoLevel = zerolog.NoLevel // Disabled disables the logger. Disabled = zerolog.Disabled // TraceLevel defines trace log level. TraceLevel = zerolog.TraceLevel )
Variables ¶
This section is empty.
Functions ¶
func File ¶
func File(filename string, c FileConfig, l levels) zerolog.LevelWriter
func GetHttpWriter ¶ added in v0.2.0
func GetHttpWriter(method string, endpoint string, l levels) zerolog.LevelWriter
func InitLogger ¶
func InitLogger(writers ...zerolog.LevelWriter) error
func New ¶ added in v0.2.0
func New(writers ...zerolog.LevelWriter) (zlog, error)
func PrintWriterError ¶ added in v0.2.0
func PrintWriterError(format string, a ...interface{})
func Sentry ¶
func Sentry(sentryConf SentryConfig, flushTimeout time.Duration, lvls levels) zerolog.LevelWriter
Sentry creates and return zerolog.LevelWriter interface. Configured by SentryConfig(heir sentry.ClientOptions).
func SentryFromClient ¶ added in v0.1.6
func SentryFromClient(sentryClient *sentry.Client, flushTimeout time.Duration, lvls levels) zerolog.LevelWriter
func SentryWithHub ¶ added in v0.1.5
func SentryWithHub(sentryConf SentryConfig, flushTimeout time.Duration, lvls levels) zerolog.LevelWriter
SentryWithHub creates and return zerolog.LevelWriter interface. Unlike Sentry() it also adds a sentry.Client to the sentry.Hub(like sentry.Init).
func SetTimeFieldFormat ¶ added in v0.2.0
func SetTimeFieldFormat(format string)
func SkipSentry ¶ added in v0.1.7
func StdErr ¶
func StdErr(l levels) zerolog.LevelWriter
func StdOut ¶
func StdOut(l levels) zerolog.LevelWriter
Types ¶
type FileConfig ¶
type FileConfig struct { // MaxSize is the maximum size in megabytes of the log file before it gets // rotated. It defaults to 100 megabytes. MaxSize int // MaxAge is the maximum number of days to retain old log files based on the // timestamp encoded in their filename. Note that a day is defined as 24 // hours and may not exactly correspond to calendar days due to daylight // savings, leap seconds, etc. The default is not to remove old log files // based on age. MaxAge int // MaxBackups is the maximum number of old log files to retain. The default // is to retain all old log files (though MaxAge may still cause them to get // deleted.) MaxBackups int // LocalTime determines if the time used for formatting the timestamps in // backup files is the computer's local time. The default is to use UTC // time. LocalTime bool // Compress determines if the rotated log files should be compressed // using gzip. The default is not to perform compression. Compress bool }
type HttpWriter ¶ added in v0.2.0
type HttpWriter struct {
// contains filtered or unexported fields
}
func (*HttpWriter) WriteLevel ¶ added in v0.2.0
type LevelWriter ¶
type LevelWriter struct {
// contains filtered or unexported fields
}
func (*LevelWriter) Close ¶ added in v0.2.0
func (lw *LevelWriter) Close() error
func (*LevelWriter) WriteLevel ¶
type SentryConfig ¶
type SentryConfig sentry.ClientOptions
type SentryWriter ¶
type SentryWriter struct {
// contains filtered or unexported fields
}
func (*SentryWriter) Close ¶
func (sw *SentryWriter) Close() error
func (*SentryWriter) WriteLevel ¶
type WriterError ¶ added in v0.2.0
type WriterError interface {
Print(format string, a ...interface{})
}
var ( ErrInitWriter = errors.New("One or more LevelWriters is nil(error).") WriterErrorLog WriterError = defaultWriterError{} )
Click to show internal directories.
Click to hide internal directories.