mirror of https://github.com/statping/statping
vue
parent
71b7254fce
commit
b3ff399aee
|
@ -6,7 +6,6 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/getsentry/sentry-go"
|
|
||||||
"github.com/hunterlong/statping/types/core"
|
"github.com/hunterlong/statping/types/core"
|
||||||
"github.com/hunterlong/statping/utils"
|
"github.com/hunterlong/statping/utils"
|
||||||
"io"
|
"io"
|
||||||
|
@ -81,21 +80,13 @@ func sendLog(next http.Handler) http.Handler {
|
||||||
next.ServeHTTP(w, r)
|
next.ServeHTTP(w, r)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
t2 := utils.Now().Sub(t1)
|
|
||||||
next.ServeHTTP(w, r)
|
next.ServeHTTP(w, r)
|
||||||
|
t2 := utils.Now().Sub(t1)
|
||||||
log.WithFields(utils.ToFields(w, r)).
|
log.WithFields(utils.ToFields(w, r)).
|
||||||
WithField("url", r.RequestURI).
|
WithField("url", r.RequestURI).
|
||||||
WithField("method", r.Method).
|
WithField("method", r.Method).
|
||||||
WithField("load_micro_seconds", t2.Microseconds()).
|
WithField("load_micro_seconds", t2.Microseconds()).
|
||||||
Infoln(fmt.Sprintf("%v (%v) | IP: %v", r.RequestURI, r.Method, r.Host))
|
Infoln(fmt.Sprintf("%v (%v) | IP: %v", r.RequestURI, r.Method, r.Host))
|
||||||
|
|
||||||
e := sentry.NewEvent()
|
|
||||||
e.Timestamp = utils.Now().Unix()
|
|
||||||
e.Dist = "development"
|
|
||||||
e.Environment = "development"
|
|
||||||
e.Transaction = "http_response"
|
|
||||||
sentry.CaptureEvent(e)
|
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ package utils
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/fatih/structs"
|
"github.com/fatih/structs"
|
||||||
|
"github.com/getsentry/sentry-go"
|
||||||
"github.com/hunterlong/statping/types/null"
|
"github.com/hunterlong/statping/types/null"
|
||||||
Logger "github.com/sirupsen/logrus"
|
Logger "github.com/sirupsen/logrus"
|
||||||
"gopkg.in/natefinch/lumberjack.v2"
|
"gopkg.in/natefinch/lumberjack.v2"
|
||||||
|
@ -134,6 +135,8 @@ func InitLogs() error {
|
||||||
})
|
})
|
||||||
checkVerboseMode()
|
checkVerboseMode()
|
||||||
|
|
||||||
|
sentry.CaptureMessage("It works!")
|
||||||
|
|
||||||
LastLines = make([]*logRow, 0)
|
LastLines = make([]*logRow, 0)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue