Back to godoc.org
github.com/alimy/logus

Package logus

v0.1.1
Latest Go to latest

The highest tagged major version is .

Published: Dec 16, 2018 | License: Apache-2.0 | Module: github.com/alimy/logus

Index

func DPanic

func DPanic(msg string, fields ...zap.Field)

DPanic logs a message at DPanicLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

If the logger is in development mode, it then panics (DPanic means "development panic"). This is useful for catching errors that are recoverable, but shouldn't ever happen.

func Debug

func Debug(msg string, fields ...zap.Field)

Debug logs a message at DebugLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

func Error

func Error(msg string, fields ...zap.Field)

Error logs a message at ErrorLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

func Fatal

func Fatal(msg string, fields ...zap.Field)

Fatal logs a message at FatalLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

The logger then calls os.Exit(1), even if logging at FatalLevel is disabled.

func InDevelopment

func InDevelopment(opts ...zap.Option)

InDevelopment is a reasonable development logging configuration. Logging is enabled at DebugLevel and above.

It enables development mode (which makes DPanicLevel logs panic), uses a console encoder, writes to standard error, and disables sampling. StackTraces are automatically included on logs of WarnLevel and above.

func InProduction

func InProduction(opts ...zap.Option)

InProduction is a reasonable production logging configuration. Logging is enabled at InfoLevel and above.

It uses a JSON encoder, writes to standard error, and enables sampling. StackTraces are automatically included on logs of ErrorLevel and above.

func Info

func Info(msg string, fields ...zap.Field)

Info logs a message at InfoLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

func Named

func Named(s string)

Named adds a new path segment to the logger's name. Segments are joined by periods. By default, Loggers are unnamed.

func Panic

func Panic(msg string, fields ...zap.Field)

Fatal logs a message at FatalLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

The logger then calls os.Exit(1), even if logging at FatalLevel is disabled.

func Sync

func Sync() error

Sync calls the underlying Core's Sync method, flushing any buffered log entries. Applications should take care to call Sync before exiting.

func Warn

func Warn(msg string, fields ...zap.Field)

Warn logs a message at WarnLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

func With

func With(fields ...zap.Field)

With creates a child logger and adds structured context to it. Fields added to the child don't affect the parent, and vice versa.

func WithCallerSkip

func WithCallerSkip(skip int)

WithCallerSkip increases the number of callers skipped by caller annotation (as enabled by the AddCaller option).

func WithOptions

func WithOptions(opts ...zap.Option)

WithOptions applies the supplied Options.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier