logus

package module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2018 License: Apache-2.0 Imports: 1 Imported by: 0

README

logus

Just a wrap of Zap, export useful interface.

package main

import "github.com/alimy/logus"

func main() {
    logus.Debug("just a wrap of zap")
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL