logger

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package logger manages loggers used in dragonboat.

Index

Constants

View Source
const (
	// RepoName is the repo name used in capnslog.
	RepoName = "github.com/lni/dragonboat"
)

Variables

This section is empty.

Functions

func GetLogger

func GetLogger(pkgName string) *dragonboatLogger

GetLogger returns the logger for the specified package name. The most common use case for the returned logger is to set its log verbosity level.

func SetLoggerFactory

func SetLoggerFactory(f Factory)

SetLoggerFactory sets the factory function used to create ILogger instances.

Types

type Factory

type Factory func(pkgName string) ILogger

Factory is the factory method for creating logger used for the specified package.

type ILogger

type ILogger interface {
	SetLevel(LogLevel)
	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Warningf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Panicf(format string, args ...interface{})
}

ILogger is the interface implemented by loggers that can be used by dragonboat. You can implement your own ILogger implementation by building wrapper struct on top of your favourite logging library.

func CreateCapnsLog

func CreateCapnsLog(pkgName string) ILogger

CreateCapnsLog creates an ILogger instance based on capnslog.

type LogLevel

type LogLevel int

LogLevel is the log level defined in dragonboat.

const (
	// CRITICAL is the CRITICAL log level
	CRITICAL LogLevel = iota - 1
	// ERROR is the ERROR log level
	ERROR
	// WARNING is the WARNING log level
	WARNING
	// INFO is the INFO log level
	INFO
	// DEBUG is the DEBUG log level
	DEBUG
)

Jump to

Keyboard shortcuts

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