Introduce #version
This commit is contained in:
parent
37aacf973b
commit
69497c77e4
@ -13,14 +13,14 @@ var (
|
|||||||
func SetupLogging() {
|
func SetupLogging() {
|
||||||
logger = log.New(os.Stdout, "", log.Ldate|log.Lmicroseconds)
|
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("GOMAXPROCS is set to %d", runtime.GOMAXPROCS(-1))
|
||||||
Log("Storage path: %s", Config.Storage)
|
Log("Storage path: %s", Config.Storage)
|
||||||
Log("Server is running at http://127.0.0.1:%d", Config.Port)
|
Log("Server is running at http://127.0.0.1:%d", Config.Port)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Log(format string, args ...interface{}) {
|
func Log(format string, args ...interface{}) {
|
||||||
logger.Printf("[INFO] "+format, args...)
|
logger.Printf("[INFO] "+format, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Debug(format string, args ...interface{}) {
|
func Debug(format string, args ...interface{}) {
|
||||||
@ -35,6 +35,6 @@ func Error(err error, format string, args ...interface{}) {
|
|||||||
if Config.Env == "development" {
|
if Config.Env == "development" {
|
||||||
panic(err)
|
panic(err)
|
||||||
} else {
|
} else {
|
||||||
logger.Printf(" ", err.Error())
|
logger.Printf(" ", err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
4
main.go
4
main.go
@ -8,6 +8,10 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
Version = "0.1.3"
|
||||||
|
)
|
||||||
|
|
||||||
func HandleShutdown() {
|
func HandleShutdown() {
|
||||||
ch := make(chan os.Signal)
|
ch := make(chan os.Signal)
|
||||||
signal.Notify(ch, os.Interrupt, os.Kill, syscall.SIGTERM, syscall.SIGINT)
|
signal.Notify(ch, os.Interrupt, os.Kill, syscall.SIGTERM, syscall.SIGINT)
|
||||||
|
@ -30,6 +30,7 @@ func StatusHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
func DebugHandler(w http.ResponseWriter, r *http.Request) {
|
func DebugHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
info := make(map[string]interface{})
|
info := make(map[string]interface{})
|
||||||
|
info["version"] = Version
|
||||||
info["goroutines"] = runtime.NumGoroutine()
|
info["goroutines"] = runtime.NumGoroutine()
|
||||||
|
|
||||||
s, err := storage.Status()
|
s, err := storage.Status()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user