1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2024-12-24 10:07:21 +02:00
woodpecker/vendor/github.com/gin-gonic/gin/debug.go
2015-09-29 17:34:44 -07:00

41 lines
941 B
Go

// Copyright 2014 Manu Martinez-Almeida. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package gin
import (
"log"
"os"
)
var debugLogger = log.New(os.Stdout, "[GIN-debug] ", 0)
func IsDebugging() bool {
return ginMode == debugCode
}
func debugPrintRoute(httpMethod, absolutePath string, handlers HandlersChain) {
if IsDebugging() {
nuHandlers := len(handlers)
handlerName := nameOfFunction(handlers[nuHandlers-1])
debugPrint("%-5s %-25s --> %s (%d handlers)\n", httpMethod, absolutePath, handlerName, nuHandlers)
}
}
func debugPrint(format string, values ...interface{}) {
if IsDebugging() {
debugLogger.Printf(format, values...)
}
}
func debugPrintWARNING() {
debugPrint("[WARNING] Running in DEBUG mode! Disable it before going production\n")
}
func debugPrintError(err error) {
if err != nil {
debugPrint("[ERROR] %v\n", err)
}
}