summaryrefslogtreecommitdiffstats
path: root/app/diagnostics.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2017-04-03 07:01:32 -0400
committerGeorge Goldberg <george@gberg.me>2017-04-03 12:01:32 +0100
commit67a8770118a7e8902efe537c4257b7442cb651fd (patch)
treeba3e81222aaa9131cc5b1b4ed4a79837cf31b648 /app/diagnostics.go
parentc3d095b465ed87c086409992ef78b62a06c09909 (diff)
downloadchat-67a8770118a7e8902efe537c4257b7442cb651fd.tar.gz
chat-67a8770118a7e8902efe537c4257b7442cb651fd.tar.bz2
chat-67a8770118a7e8902efe537c4257b7442cb651fd.zip
Creating unit tests for diagnostics (#5932)
Diffstat (limited to 'app/diagnostics.go')
-rw-r--r--app/diagnostics.go13
1 files changed, 11 insertions, 2 deletions
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,
})