fix whitespaces.

This commit is contained in:
Miroslav Šedivý 2021-09-20 00:19:10 +02:00
parent f96466b7b9
commit e95cc99ea2
2 changed files with 13 additions and 0 deletions

View File

@ -39,12 +39,15 @@ func (r *router) Route(pattern string, fn func(types.Router)) {
func (r *router) Get(pattern string, fn types.RouterHandler) {
r.chi.Get(pattern, routeHandler(fn))
}
func (r *router) Post(pattern string, fn types.RouterHandler) {
r.chi.Post(pattern, routeHandler(fn))
}
func (r *router) Put(pattern string, fn types.RouterHandler) {
r.chi.Put(pattern, routeHandler(fn))
}
func (r *router) Delete(pattern string, fn types.RouterHandler) {
r.chi.Delete(pattern, routeHandler(fn))
}
@ -62,6 +65,7 @@ func (r *router) WithBypass(fn func(next http.Handler) http.Handler) types.Route
func (r *router) Use(fn types.MiddlewareHandler) {
r.chi.Use(middlewareHandler(fn))
}
func (r *router) UseBypass(fn func(next http.Handler) http.Handler) {
r.chi.Use(fn)
}

View File

@ -15,17 +15,21 @@ type logger struct {
func (l logger) Trace(msg string) {
l.logger.Trace().Msg(strings.TrimSpace(msg))
}
func (l logger) Tracef(format string, args ...interface{}) {
msg := fmt.Sprintf(format, args...)
l.logger.Trace().Msg(strings.TrimSpace(msg))
}
func (l logger) Debug(msg string) {
l.logger.Debug().Msg(strings.TrimSpace(msg))
}
func (l logger) Debugf(format string, args ...interface{}) {
msg := fmt.Sprintf(format, args...)
l.logger.Debug().Msg(strings.TrimSpace(msg))
}
func (l logger) Info(msg string) {
if strings.Contains(msg, "duplicated packet") {
return
@ -33,6 +37,7 @@ func (l logger) Info(msg string) {
l.logger.Info().Msg(strings.TrimSpace(msg))
}
func (l logger) Infof(format string, args ...interface{}) {
msg := fmt.Sprintf(format, args...)
if strings.Contains(msg, "duplicated packet") {
@ -41,16 +46,20 @@ func (l logger) Infof(format string, args ...interface{}) {
l.logger.Info().Msg(strings.TrimSpace(msg))
}
func (l logger) Warn(msg string) {
l.logger.Warn().Msg(strings.TrimSpace(msg))
}
func (l logger) Warnf(format string, args ...interface{}) {
msg := fmt.Sprintf(format, args...)
l.logger.Warn().Msg(strings.TrimSpace(msg))
}
func (l logger) Error(msg string) {
l.logger.Error().Msg(strings.TrimSpace(msg))
}
func (l logger) Errorf(format string, args ...interface{}) {
msg := fmt.Sprintf(format, args...)
l.logger.Error().Msg(strings.TrimSpace(msg))