logger

package
v0.0.0-...-93a8726 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: MIT Imports: 2 Imported by: 3

Documentation

Overview

Package logger manages loggers used in Tugboat.

Index

Constants

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

Variables

This section is empty.

Functions

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.

func GetLogger

func GetLogger(pkgName string) ILogger

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.

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