util

package
v0.0.0-...-431350c Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Degub    = -1
	Info     = 0
	Warn     = 1
	Error    = 2
	Critical = 3
)

Variables

This section is empty.

Functions

func NewJaegerTracer

func NewJaegerTracer() (opentracing.Tracer, io.Closer, error)

func NewMatcher

func NewMatcher() language.Matcher

言語対応しており、受け付ける言語を列挙

func NewStandardLogger

func NewStandardLogger(
	host string,
	service string,
	writer io.Writer,
) (*standardLogger, func(), error)

func NewZapLogger

func NewZapLogger(
	path string,
	host string,
	service string,
	level Level,
) (*zapLogger, func(), error)

Types

type Config

type Config struct {
	IsCGI         bool   `mapstructure:"IS_CGI"`
	ServerAddress string `mapstructure:"SERVER_ADDRESS"`
	URLPrefix     string `mapstructure:"SERVER_URL_PREFIX"`
	DBDriver      string `mapstructure:"DB_DRIVER"`
	DBSource      string `mapstructure:"DB_SOURCE"`
	LogPath       string `mapstructure:"LOG_PATH"`
	Host          string `mapstructure:"HOST"`
	Service       string `mapstructure:"SERVICE"`
	GRPCURL       string `mapstructure:"GRPC_URL"`
}

func LoadConfig

func LoadConfig(path string) (config Config, err error)

Load config parameters using viper

type Level

type Level int

Logging level

func (Level) String

func (lv Level) String() string

type Logger

type Logger interface {
	Critical(ctx context.Context, msg string)
	Error(ctx context.Context, mst string)
	Warn(ctx context.Context, mst string)
	Info(ctx context.Context, mst string)
	Debug(ctx context.Context, mst string)

	Criticalf(ctx context.Context, msg string, a ...interface{})
	Errorf(ctx context.Context, mst string, a ...interface{})
	Warnf(ctx context.Context, mst string, a ...interface{})
	Infof(ctx context.Context, mst string, a ...interface{})
	Debugf(ctx context.Context, mst string, a ...interface{})

	Print(ctx context.Context, lv Level, msg string)
}

func NewFileLogger

func NewFileLogger(
	path string,
	host string,
	service string,
) (Logger, func(), error)

type SortKey

type SortKey int
const (
	MemberID SortKey = iota
	Birthday
	Height
)

Jump to

Keyboard shortcuts

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