From 67a8770118a7e8902efe537c4257b7442cb651fd Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Mon, 3 Apr 2017 07:01:32 -0400 Subject: Creating unit tests for diagnostics (#5932) --- app/diagnostics.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'app/diagnostics.go') diff --git a/app/diagnostics.go b/app/diagnostics.go index d3eee29c5..2c8211f42 100644 --- a/app/diagnostics.go +++ b/app/diagnostics.go @@ -4,6 +4,8 @@ package app import ( + "log" + "os" "runtime" "github.com/mattermost/platform/model" @@ -44,7 +46,7 @@ var client *analytics.Client func SendDailyDiagnostics() { if *utils.Cfg.LogSettings.EnableDiagnostics { - initDiagnostics() + initDiagnostics("") trackActivity() trackConfig() trackLicense() @@ -52,9 +54,16 @@ func SendDailyDiagnostics() { } } -func initDiagnostics() { +func initDiagnostics(endpoint string) { if client == nil { client = analytics.New(SEGMENT_KEY) + // For testing + if endpoint != "" { + client.Endpoint = endpoint + client.Verbose = true + client.Size = 1 + client.Logger = log.New(os.Stdout, "segment ", log.LstdFlags) + } client.Identify(&analytics.Identify{ UserId: utils.CfgDiagnosticId, }) -- cgit v1.2.3-1-g7c22