From f6b75e2de27219f55bfd8fca0e3eb9e58e5df6ec Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Fri, 27 Nov 2020 12:56:12 +0000 Subject: [PATCH] Ensure error reporting works in Google Cloud --- log/stackdriver.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/log/stackdriver.go b/log/stackdriver.go index a907c6aa..bdce4b50 100644 --- a/log/stackdriver.go +++ b/log/stackdriver.go @@ -32,6 +32,8 @@ import ( "cloud.google.com/go/logging" ) +var proj = os.Getenv("PROJECT") + type StackdriverLogger struct { name string client *logging.Client @@ -45,12 +47,10 @@ func NewStackDriver() *StackdriverLogger { ctx := context.Background() - proj := os.Getenv("PROJECT") - hook := new(StackdriverLogger) conf := errorreporting.Config{ - ServiceName: name, + ServiceName: "surreal", ServiceVersion: build.GetInfo().Ver, } @@ -91,7 +91,7 @@ func NewStackDriver() *StackdriverLogger { log.Fatalf("Failed to connect to Stackdriver: %v", err) } - hook.logger = hook.client.Logger(name) + hook.logger = hook.client.Logger("surreal") return hook