Documentation
¶
Index ¶
Constants ¶
View Source
const ( Reset = "\033[0m" Red = "\033[31m" Green = "\033[32m" Yellow = "\033[33m" Blue = "\033[34m" Magenta = "\033[35m" Cyan = "\033[36m" White = "\033[37m" BlueBold = "\033[34;1m" MagentaBold = "\033[35;1m" RedBold = "\033[31;1m" YellowBold = "\033[33;1m" )
Colors
Variables ¶
View Source
var ( // Discard logger will print any log to io.Discard Discard = New(log.New(io.Discard, "", log.LstdFlags), Config{}) // Default Default logger Default = New(log.New(os.Stdout, "\r\n", log.LstdFlags), Config{ SlowThreshold: 200 * time.Millisecond, LogLevel: Warn, IgnoreRecordNotFoundError: false, Colorful: true, }) )
View Source
var DefaultOption = Option{ MaxIdle: 5, MaxActive: 100, MaxQueueSize: 10, IdleTimeout: 240 * time.Second, Logger: Default, }
View Source
var ErrRecordNotFound = errors.New("record not found")
ErrRecordNotFound record not found error
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { SlowThreshold time.Duration Colorful bool IgnoreRecordNotFoundError bool ParameterizedQueries bool LogLevel LogLevel }
Config logger config
type LockManager ¶
type LockManager interface { Lock(context context.Context, key string, duration time.Duration) Lock Close() error }
func NewLockManager ¶
func NewLockManager(redisAddr string, optionalOption ...Option) (LockManager, error)
type Logger ¶
type Logger interface { LogMode(LogLevel) Logger Info(string, ...interface{}) Warn(string, ...interface{}) Error(string, ...interface{}) }
Logger logger interface
Click to show internal directories.
Click to hide internal directories.