log

package
v0.0.0-...-480e040 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

README

Log

It's a log module base on zap log, easy for use and config it

Config

    import "github.com/maxjkfc/cocola/log"

    func main() {
        // NewZapConfig - new the zap config
        // Env - set the environment for log
        // Level - set the log Level
        // Build - build the log instrace
	    if _ , err := NewZapConfig().Env(DEV).Level(DEBUG).Build(); err != nil {
	    	log.Error(err)
	    }
        log.Zlog().Info("This is a log")
    }

Feature

TODO

  • [] Notice
  • [] Interface

Documentation

Index

Constants

View Source
const (
	DEBUG = "debug"
	INFO  = "info"
	WARN  = "warn"
	ERROR = "error"
	FATAL = "fatal"
	DEV   = "dev"
	PRD   = "prd"
)

Variables

This section is empty.

Functions

func Debug

func Debug(msg string, output interface{})

func Error

func Error(msg string, output interface{})

func Fatal

func Fatal(msg string, output interface{})

func Info

func Info(msg string, output interface{})

func Panic

func Panic(msg string, output interface{})

func Warn

func Warn(msg string, output interface{})

Types

type Configer

type Configer interface {
	Level(string) Configer
	Name(string) Configer
	Env(string) Configer
	AddCallerSkip(int) Configer
	Build() (Logger, error)
}

func NewZapConfig

func NewZapConfig() Configer

type Logger

type Logger interface {
	Debug(msg string, output interface{})
	Info(msg string, output interface{})
	Warn(msg string, output interface{})
	Error(msg string, output interface{})
	Panic(msg string, output interface{})
	Fatal(msg string, output interface{})
}

func Log

func Log() Logger

Jump to

Keyboard shortcuts

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