mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-10-19 10:07:29 +00:00
refactor: update logging related logic
This commit is contained in:
@@ -171,6 +171,11 @@ func GetTimestamp() int64 {
|
||||
return time.Now().Unix()
|
||||
}
|
||||
|
||||
func GetTimeString() string {
|
||||
now := time.Now()
|
||||
return fmt.Sprintf("%s%d", now.Format("20060102150405"), now.UnixNano()%1e9)
|
||||
}
|
||||
|
||||
func Max(a int, b int) int {
|
||||
if a >= b {
|
||||
return a
|
||||
@@ -190,3 +195,7 @@ func GetOrDefault(env string, defaultValue int) int {
|
||||
}
|
||||
return num
|
||||
}
|
||||
|
||||
func MessageWithRequestId(message string, id string) string {
|
||||
return fmt.Sprintf("%s (request id: %s)", message, id)
|
||||
}
|
||||
|
Reference in New Issue
Block a user