utils

package
v0.0.0-...-31ac180 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func NewValidator

func NewValidator() *validator.Validate

Types

type Config

type Config struct {
	Dev         bool   `yaml:"dev"`
	Port        string `yaml:"port"`
	WebEnable   bool   `yaml:"web_enable"`
	TraceEnable bool   `yaml:"trace_enable"`
	TraceUrl    string
	LogConfig   LogConfig `yaml:"log,omitempty"`
	LogLevel    string
}

func NewConfig

func NewConfig() (*Config, error)

TODO: need config path

type LogConfig

type LogConfig struct {
	Level       string
	Filename    string `yaml:"filename"`
	MaxSize     int
	MaxAge      int
	MaxBackups  int
	TraceEnable bool
	TraceUrl    string
}

type Logger

type Logger interface {
	Debugf(template string, args ...interface{})
	Debugw(template string, keysAndValues ...interface{})
	Infof(template string, args ...interface{})
	Infow(template string, keysAndValues ...interface{})
	Warnf(template string, args ...interface{})
	Warnw(template string, keysAndValues ...interface{})
	Errorf(template string, args ...interface{})
	Errorw(template string, keysAndValues ...interface{})
}

func NewLogger

func NewLogger(cfg *Config) Logger

type Tracer

type Tracer interface {
	Tracer(name string, options ...oteltrace.TracerOption) oteltrace.Tracer
	SpanFromContext(ctx context.Context) oteltrace.Span
	Enable() bool
}

func NewTracer

func NewTracer(cfg *Config) (Tracer, error)

Jump to

Keyboard shortcuts

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