package module
v0.3.0 Latest Latest

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

Go to latest
Published: Aug 6, 2020 License: MIT Imports: 2 Imported by: 8


Generic leveled logger interface

Build Status Coverage Status Go.Dev reference Go Report Card Release Downloads


Checkout example for details.

go get -u clevergo.tech/log
Standard Logger

StdLogger wraps Go standard logger log.Logger.

import (
    stdlog "log"


var logger log.Logger = log.New(os.Stderr, "", stdlog.LstdFlags)
import (

var logger log.Logger = logrus.New()
import (

var logger log.Logger = zap.NewExample().Sugar()
logger.Debug(args ...interface{})
logger.Debugf(format string, args ...interface{})
logger.Info(args ...interface{})
logger.Infof(format string, args ...interface{})
logger.Warn(args ...interface{})
logger.Warnf(format string, args ...interface{})
logger.Error(args ...interface{})
logger.Errorf(format string, args ...interface{})
logger.Fatal(args ...interface{})
logger.Fatalf(format string, args ...interface{})




This section is empty.


This section is empty.


This section is empty.


type Logger

type Logger interface {
	Debug(args ...interface{})
	Debugf(format string, args ...interface{})

	Info(args ...interface{})
	Infof(format string, args ...interface{})

	Warn(args ...interface{})
	Warnf(format string, args ...interface{})

	Error(args ...interface{})
	Errorf(format string, args ...interface{})

	Fatal(args ...interface{})
	Fatalf(format string, args ...interface{})

Logger is a general logger interface.

type StdLogger added in v0.2.0

type StdLogger struct {

StdLogger is a wrapper of standard logger.

func New added in v0.2.0

func New(out io.Writer, prefix string, flag int) *StdLogger

New returns a standard logger.

func (*StdLogger) Debug added in v0.2.0

func (l *StdLogger) Debug(args ...interface{})

Debug implements Logger's Debug.

func (*StdLogger) Debugf added in v0.2.0

func (l *StdLogger) Debugf(format string, args ...interface{})

Debugf implements Logger's Debugf.

func (*StdLogger) Error added in v0.2.0

func (l *StdLogger) Error(args ...interface{})

Error implements Logger's Error.

func (*StdLogger) Errorf added in v0.2.0

func (l *StdLogger) Errorf(format string, args ...interface{})

Errorf implements Logger's Errorf.

func (*StdLogger) Fatal added in v0.2.0

func (l *StdLogger) Fatal(args ...interface{})

Fatal implements Logger's Fatal.

func (*StdLogger) Fatalf added in v0.2.0

func (l *StdLogger) Fatalf(format string, args ...interface{})

Fatalf implements Logger's Fatalf.

func (*StdLogger) Info added in v0.2.0

func (l *StdLogger) Info(args ...interface{})

Info implements Logger's Info.

func (*StdLogger) Infof added in v0.2.0

func (l *StdLogger) Infof(format string, args ...interface{})

Infof implements Logger's Infof.

func (*StdLogger) Warn added in v0.2.0

func (l *StdLogger) Warn(args ...interface{})

Warn implements Logger's Warn.

func (*StdLogger) Warnf added in v0.2.0

func (l *StdLogger) Warnf(format string, args ...interface{})

Warnf implements Logger's Warnf.

Jump to

Keyboard shortcuts

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