fix typo and add comments (#2760)

This commit is contained in:
ziheng 2021-06-24 13:07:49 +08:00 committed by GitHub
parent dd8a27c0b6
commit be860ec157
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -34,7 +34,7 @@ func Recovery() HandlerFunc {
return RecoveryWithWriter(DefaultErrorWriter) return RecoveryWithWriter(DefaultErrorWriter)
} }
//CustomRecovery returns a middleware that recovers from any panics and calls the provided handle func to handle it. // CustomRecovery returns a middleware that recovers from any panics and calls the provided handle func to handle it.
func CustomRecovery(handle RecoveryFunc) HandlerFunc { func CustomRecovery(handle RecoveryFunc) HandlerFunc {
return RecoveryWithWriter(DefaultErrorWriter, handle) return RecoveryWithWriter(DefaultErrorWriter, handle)
} }
@ -165,6 +165,7 @@ func function(pc uintptr) []byte {
return name return name
} }
// timeFormat returns a customized time string for logger.
func timeFormat(t time.Time) string { func timeFormat(t time.Time) string {
timeString := t.Format("2006/01/02 - 15:04:05") timeString := t.Format("2006/01/02 - 15:04:05")
return timeString return timeString