log

package module
v0.0.0-...-4f49b8c Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2020 License: GPL-3.0 Imports: 7 Imported by: 6

README

log

Log framework written in Go.


Based on Zap.

Support:

  1. Normal Zap Logger
  2. Mysql Logger
  3. Nop Logger

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(msg string, ctx ...interface{})

Debug ...

func Error

func Error(msg string, ctx ...interface{})

Error ...

func Info

func Info(msg string, ctx ...interface{})

Info ...

func Warn

func Warn(msg string, ctx ...interface{})

Warn ...

Types

type Logger

type Logger interface {
	With(ctx ...interface{}) Logger
	Debug(msg string, ctx ...interface{})
	Info(msg string, ctx ...interface{})
	Warn(msg string, ctx ...interface{})
	Error(msg string, ctx ...interface{})
}

Logger interface

func NewNopLogger

func NewNopLogger() Logger

NewNopLogger ...

func With

func With(ctx ...interface{}) Logger

With return a new Logger with context

type MysqlLogger

type MysqlLogger struct {
	// contains filtered or unexported fields
}

MysqlLogger

func NewMysqlLogger

func NewMysqlLogger(w *zap.Logger) *MysqlLogger

NewMysqlLogger return a pointer to MysqlLogger

func (*MysqlLogger) Debug

func (s *MysqlLogger) Debug(v ...interface{})

Debug ...

func (*MysqlLogger) Debugf

func (s *MysqlLogger) Debugf(format string, v ...interface{})

Debugf ...

func (*MysqlLogger) Error

func (s *MysqlLogger) Error(v ...interface{})

Error ...

func (*MysqlLogger) Errorf

func (s *MysqlLogger) Errorf(format string, v ...interface{})

Errorf ...

func (*MysqlLogger) Info

func (s *MysqlLogger) Info(v ...interface{})

Info ...

func (*MysqlLogger) Infof

func (s *MysqlLogger) Infof(format string, v ...interface{})

Infof ...

func (*MysqlLogger) IsShowSQL

func (s *MysqlLogger) IsShowSQL() bool

IsShowSQL sql showed or not

func (*MysqlLogger) Level

func (s *MysqlLogger) Level() core.LogLevel

Level get level

func (*MysqlLogger) SetLevel

func (s *MysqlLogger) SetLevel(l core.LogLevel)

SetLevel set level

func (*MysqlLogger) ShowSQL

func (s *MysqlLogger) ShowSQL(show ...bool)

ShowSQL show sql

func (*MysqlLogger) Warn

func (s *MysqlLogger) Warn(v ...interface{})

Warn ...

func (*MysqlLogger) Warnf

func (s *MysqlLogger) Warnf(format string, v ...interface{})

Warnf ...

type ZapLoggerWapper

type ZapLoggerWapper struct {
	// contains filtered or unexported fields
}

ZapLoggerWapper zap logger wapper

func NewZapLoggerWrapper

func NewZapLoggerWrapper(logger *zap.SugaredLogger) *ZapLoggerWapper

NewZapLoggerWrapper return a pointer to ZapLoggerWapper

func Sugar

func Sugar() *ZapLoggerWapper

Sugar return sugar logger

func (*ZapLoggerWapper) Debug

func (z *ZapLoggerWapper) Debug(msg string, ctx ...interface{})

Debug ...

func (*ZapLoggerWapper) Error

func (z *ZapLoggerWapper) Error(msg string, ctx ...interface{})

Error ...

func (*ZapLoggerWapper) Info

func (z *ZapLoggerWapper) Info(msg string, ctx ...interface{})

Info ...

func (*ZapLoggerWapper) Warn

func (z *ZapLoggerWapper) Warn(msg string, ctx ...interface{})

Warn ...

func (*ZapLoggerWapper) With

func (z *ZapLoggerWapper) With(ctx ...interface{}) Logger

With return a new Logger with context

Jump to

Keyboard shortcuts

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