openlog

package module
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2021 License: Apache-2.0 Imports: 1 Imported by: 179

README

Open logging

it is not easy to unify the logger in different go packages in a big project, you want to record all of log in same format, in same file or same backend system that is where open logging comes in

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(message string, opts ...Option)

func Error

func Error(message string, opts ...Option)

func Fatal

func Fatal(message string, opts ...Option)

func Info

func Info(message string, opts ...Option)

func SetLogger

func SetLogger(l Logger)

func Warn

func Warn(message string, opts ...Option)

Types

type Logger

type Logger interface {
	Debug(message string, opts ...Option)
	Info(message string, opts ...Option)
	Warn(message string, opts ...Option)
	Error(message string, opts ...Option)
	Fatal(message string, opts ...Option)
}

Logger is a interface for log tool

func GetLogger

func GetLogger() Logger

type Option

type Option func(*Options)

func WithDepth

func WithDepth(d int) Option

func WithErr added in v1.1.1

func WithErr(d error) Option

func WithTags

func WithTags(tags Tags) Option

type Options

type Options struct {
	Tags  Tags
	Depth int
	Err   error
}

func ToOptions added in v1.1.3

func ToOptions(opts ...Option) *Options

type Tags

type Tags map[string]interface{}

Jump to

Keyboard shortcuts

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