Documentation
¶
Index ¶
- Variables
- func ExplainSQL(sql string, avars ...interface{}) string
- func GetLogger(ctx context.Context) *zerolog.Logger
- func InitLogger() *zerolog.Logger
- func PrintSQL(ctx context.Context, rowsAffected *int64, err error, cost time.Duration, ...)
- func SafeGo(fn func())
- func SetDefaultLevel(level Level)
- func SetGlobalLogger(log *zerolog.Logger)
- func SetIsPg(dbType string)
- func SetLevel(ctx context.Context, level Level) context.Context
- type Level
- type LevelKey
Constants ¶
This section is empty.
Variables ¶
View Source
var ( IsPg bool LogLevel = Debug SlowThreshold = 1 * time.Second )
Functions ¶
func ExplainSQL ¶
func InitLogger ¶
InitLogger initializes and returns a zerolog logger
func PrintSQL ¶
func PrintSQL(ctx context.Context, rowsAffected *int64, err error, cost time.Duration, query string, args ...interface{})
PrintSQL logs the SQL execution details including the query, arguments, execution time, affected rows, and any errors.
func SafeGo ¶
func SafeGo(fn func())
SafeGo runs the given function in a new goroutine and recovers from any panic, logging the error and stack trace.
func SetDefaultLevel ¶
func SetDefaultLevel(level Level)
func SetGlobalLogger ¶
SetGlobalLogger sets the global logger
Types ¶
Click to show internal directories.
Click to hide internal directories.