Remove #rollbar
This commit is contained in:
parent
f32091c3cd
commit
44ad6bc802
|
@ -14,7 +14,6 @@ var (
|
||||||
Storage string
|
Storage string
|
||||||
Env string
|
Env string
|
||||||
Port int
|
Port int
|
||||||
Rollbar string
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -22,7 +21,6 @@ func SetupConfig() {
|
||||||
flag.StringVar(&Config.Storage, "storage", "-", "Kyoto Cabinet storage path (e.g. "+DefaultProductionStorage+")")
|
flag.StringVar(&Config.Storage, "storage", "-", "Kyoto Cabinet storage path (e.g. "+DefaultProductionStorage+")")
|
||||||
flag.StringVar(&Config.Env, "environment", "development", "Process environment: development or production")
|
flag.StringVar(&Config.Env, "environment", "development", "Process environment: development or production")
|
||||||
flag.IntVar(&Config.Port, "port", 4401, "Server HTTP port")
|
flag.IntVar(&Config.Port, "port", 4401, "Server HTTP port")
|
||||||
flag.StringVar(&Config.Rollbar, "rollbar", "", "Rollbar token")
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if Config.Env == "production" && Config.Storage == "-" {
|
if Config.Env == "production" && Config.Storage == "-" {
|
||||||
|
|
13
logging.go
13
logging.go
|
@ -1,7 +1,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/stvp/rollbar"
|
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
@ -13,18 +12,11 @@ var (
|
||||||
|
|
||||||
func SetupLogging() {
|
func SetupLogging() {
|
||||||
logger = log.New(os.Stdout, "", log.Ldate|log.Lmicroseconds)
|
logger = log.New(os.Stdout, "", log.Ldate|log.Lmicroseconds)
|
||||||
rollbar.Token = Config.Rollbar
|
|
||||||
rollbar.Environment = Config.Env
|
|
||||||
|
|
||||||
Log("Burlesque started in %s environment", Config.Env)
|
Log("Burlesque started in %s environment", 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)
|
||||||
if Config.Rollbar == "" {
|
|
||||||
Log("Rollbar is not configured and disabled")
|
|
||||||
} else {
|
|
||||||
Log("Rollbar token: %s", Config.Rollbar)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func Log(format string, args ...interface{}) {
|
func Log(format string, args ...interface{}) {
|
||||||
|
@ -42,8 +34,7 @@ func Error(err error, format string, args ...interface{}) {
|
||||||
|
|
||||||
if Config.Env == "development" {
|
if Config.Env == "development" {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
} else {
|
||||||
if Config.Rollbar != "" {
|
logger.Printf(" ", err.Error())
|
||||||
rollbar.Error("error", err)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
4
main.go
4
main.go
|
@ -2,7 +2,6 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/stvp/rollbar"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
@ -21,9 +20,6 @@ func HandleShutdown() {
|
||||||
|
|
||||||
CloseStorage()
|
CloseStorage()
|
||||||
|
|
||||||
Log("Waiting for rollbar...")
|
|
||||||
rollbar.Wait()
|
|
||||||
|
|
||||||
Log("Stopped")
|
Log("Stopped")
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}()
|
}()
|
||||||
|
|
Loading…
Reference in New Issue