1
0
Fork 0

Introduce #version

This commit is contained in:
Gregory Eremin 2014-07-29 13:31:42 +07:00
parent 37aacf973b
commit 69497c77e4
3 changed files with 8 additions and 3 deletions

View File

@ -13,14 +13,14 @@ var (
func SetupLogging() {
logger = log.New(os.Stdout, "", log.Ldate|log.Lmicroseconds)
Log("Burlesque started in %s environment", Config.Env)
Log("Burlesque v%s started in %s environment", Version, Config.Env)
Log("GOMAXPROCS is set to %d", runtime.GOMAXPROCS(-1))
Log("Storage path: %s", Config.Storage)
Log("Server is running at http://127.0.0.1:%d", Config.Port)
}
func Log(format string, args ...interface{}) {
logger.Printf("[INFO] "+format, args...)
logger.Printf("[INFO] "+format, args...)
}
func Debug(format string, args ...interface{}) {
@ -35,6 +35,6 @@ func Error(err error, format string, args ...interface{}) {
if Config.Env == "development" {
panic(err)
} else {
logger.Printf(" ", err.Error())
logger.Printf(" ", err.Error())
}
}

View File

@ -8,6 +8,10 @@ import (
"syscall"
)
const (
Version = "0.1.3"
)
func HandleShutdown() {
ch := make(chan os.Signal)
signal.Notify(ch, os.Interrupt, os.Kill, syscall.SIGTERM, syscall.SIGINT)

View File

@ -30,6 +30,7 @@ func StatusHandler(w http.ResponseWriter, r *http.Request) {
func DebugHandler(w http.ResponseWriter, r *http.Request) {
info := make(map[string]interface{})
info["version"] = Version
info["goroutines"] = runtime.NumGoroutine()
s, err := storage.Status()