You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
387 B
Go
23 lines
387 B
Go
package printer
|
|
|
|
import (
|
|
"context"
|
|
"joybuywork/internal/app"
|
|
"joybuywork/internal/config"
|
|
"joybuywork/internal/consts"
|
|
)
|
|
|
|
// Print 基于环境打印日志
|
|
func Print(ctx context.Context, msg string, err error) {
|
|
if err != nil {
|
|
app.Logger.Warn(ctx, msg)
|
|
return
|
|
}
|
|
|
|
if config.Config.Server.Env == consts.Prod && !consts.PrintAllLog {
|
|
return
|
|
}
|
|
|
|
app.Logger.Info(ctx, msg)
|
|
}
|