logging

package module
v0.0.0-...-df5da8a Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2021 License: MIT Imports: 12 Imported by: 0

README

logger

Structured logging for microservices

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

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

Wrapper of Zap's Debug.

func Error

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

Wrapper of Zap's Error.

func Errorf

func Errorf(msg string, err error, fields ...zap.Field)

Outputs a Error log with formatted error.

func Fatal

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

Wrapper of Zap's Fatal.

func Fatalf

func Fatalf(msg string, err error, fields ...zap.Field)

Outputs a Fatal log with formatted error.

func Info

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

Wrapper of Zap's Info. Outputs a short log to the console. Detailed json log output to log file.

func InitLogger

func InitLogger() *zap.Logger

Initialize the Logger. Outputs short logs to the console and Write structured and detailed json logs to the log file.

func Sync

func Sync()

Wrapper of Zap's Sync.

func SyncWhenStop

func SyncWhenStop()

flush log buffer. when interrupt or terminated.

func Warn

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

Wrapper of Zap's Warn.

Types

type Config

type Config struct {
	LogFilename  string        `json:"logFilename"`
	LogLevel     string        `json:"logLevel"`
	RotationTime time.Duration `json:"rotationTime"`
}

type VersionType

type VersionType int
const (
	Revision VersionType
	Tag
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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