mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-09-19 12:10:30 +00:00
Improve logging (#1158)
* switch default log level to info add start message and cleanup server start * refactor code * fix agent debug / trace logging
This commit is contained in:
@@ -13,8 +13,8 @@ import (
|
||||
// Requests without errors are logged using log.Info().
|
||||
//
|
||||
// It receives:
|
||||
// 1. A time package format string (e.g. time.RFC3339).
|
||||
// 2. A boolean stating whether to use UTC time zone or local.
|
||||
// 1. A time package format string (e.g. time.RFC3339).
|
||||
// 2. A boolean stating whether to use UTC time zone or local.
|
||||
func Logger(timeFormat string, utc bool) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
start := time.Now()
|
||||
@@ -42,7 +42,7 @@ func Logger(timeFormat string, utc bool) gin.HandlerFunc {
|
||||
// Append error field if this is an erroneous request.
|
||||
log.Error().Str("error", c.Errors.String()).Fields(entry).Msg("")
|
||||
} else {
|
||||
log.Info().Fields(entry).Msg("")
|
||||
log.Debug().Fields(entry).Msg("")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -64,7 +64,7 @@ func Refresh(c *gin.Context) {
|
||||
// if we really want to fail the request, do we?
|
||||
log.Error().Msgf("cannot refresh access token for %s. %s", user.Login, err)
|
||||
} else {
|
||||
log.Info().Msgf("refreshed access token for %s", user.Login)
|
||||
log.Debug().Msgf("refreshed access token for %s", user.Login)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user