mirror of https://github.com/statping/statping
DISABLE_LOGS environment variable - UI updates
parent
67e781925d
commit
67283abac3
|
@ -218,6 +218,7 @@ func HelpEcho() {
|
|||
fmt.Println(" PORT - Set the outgoing port for the HTTP server (or use -port)")
|
||||
fmt.Println(" IP - Bind a specific IP address to the HTTP server (or use -ip)")
|
||||
fmt.Println(" STATPING_DIR - Set a absolute path for the root path of Statping server (logs, assets, SQL db)")
|
||||
fmt.Println(" DISABLE_LOGS - Disable viewing and writing to the log file (default is false)")
|
||||
fmt.Println(" DB_CONN - Automatic Database connection (sqlite, postgres, mysql)")
|
||||
fmt.Println(" DB_HOST - Database hostname or IP address")
|
||||
fmt.Println(" DB_USER - Database username")
|
||||
|
|
|
@ -217,22 +217,13 @@ func (s *Service) checkHttp(record bool) *Service {
|
|||
}
|
||||
t2 := time.Now()
|
||||
s.Latency = t2.Sub(t1).Seconds()
|
||||
if err != nil {
|
||||
if record {
|
||||
recordFailure(s, fmt.Sprintf("HTTP Error %v", err))
|
||||
}
|
||||
return s
|
||||
}
|
||||
s.LastResponse = string(content)
|
||||
s.LastStatusCode = res.StatusCode
|
||||
|
||||
if s.Expected.String != "" {
|
||||
if err != nil {
|
||||
utils.Log(2, err)
|
||||
}
|
||||
match, err := regexp.MatchString(s.Expected.String, string(content))
|
||||
if err != nil {
|
||||
utils.Log(2, err)
|
||||
utils.Log(2, fmt.Sprintf("Service %v expected: %v to match %v", s.Name, string(content), s.Expected.String))
|
||||
}
|
||||
if !match {
|
||||
if record {
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
<tr>
|
||||
<th scope="col">Name</th>
|
||||
<th scope="col" class="d-none d-md-table-cell">Status</th>
|
||||
<th scope="col">Visibility</th>
|
||||
<th scope="col">Group</th>
|
||||
<th scope="col" class="d-none d-md-table-cell">Visibility</th>
|
||||
<th scope="col" class="d-none d-md-table-cell">Group</th>
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Code generated by go generate; DO NOT EDIT.
|
||||
// This file was generated by robots at
|
||||
// 2019-05-14 13:40:52.036043 -0700 PDT m=+0.508533092
|
||||
// 2019-05-20 08:45:09.347759 -0700 PDT m=+0.489358639
|
||||
//
|
||||
// This contains the most recently Markdown source for the Statping Wiki.
|
||||
package source
|
||||
|
|
|
@ -91,6 +91,9 @@ func rotate() {
|
|||
|
||||
// Log creates a new entry in the Logger. Log has 1-5 levels depending on how critical the log/error is
|
||||
func Log(level int, err interface{}) error {
|
||||
if disableLogs {
|
||||
return nil
|
||||
}
|
||||
pushLastLine(err)
|
||||
var outErr error
|
||||
switch level {
|
||||
|
|
|
@ -36,7 +36,8 @@ import (
|
|||
|
||||
var (
|
||||
// Directory returns the current path or the STATPING_DIR environment variable
|
||||
Directory string
|
||||
Directory string
|
||||
disableLogs bool
|
||||
)
|
||||
|
||||
// init will set the utils.Directory to the current running directory, or STATPING_DIR if it is set
|
||||
|
@ -51,6 +52,8 @@ func init() {
|
|||
}
|
||||
Directory = dir
|
||||
}
|
||||
logger := os.Getenv("DISABLE_LOGS")
|
||||
disableLogs, _ = strconv.ParseBool(logger)
|
||||
}
|
||||
|
||||
// ToInt converts a int to a string
|
||||
|
|
|
@ -1 +1 @@
|
|||
0.80.58
|
||||
0.80.59
|
||||
|
|
Loading…
Reference in New Issue