DISABLE_LOGS environment variable - UI updates

pull/194/head
Hunter Long 2019-05-20 09:21:32 -07:00
parent 67e781925d
commit 67283abac3
7 changed files with 13 additions and 15 deletions

View File

@ -218,6 +218,7 @@ func HelpEcho() {
fmt.Println(" PORT - Set the outgoing port for the HTTP server (or use -port)") 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(" 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(" 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_CONN - Automatic Database connection (sqlite, postgres, mysql)")
fmt.Println(" DB_HOST - Database hostname or IP address") fmt.Println(" DB_HOST - Database hostname or IP address")
fmt.Println(" DB_USER - Database username") fmt.Println(" DB_USER - Database username")

View File

@ -217,22 +217,13 @@ func (s *Service) checkHttp(record bool) *Service {
} }
t2 := time.Now() t2 := time.Now()
s.Latency = t2.Sub(t1).Seconds() 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.LastResponse = string(content)
s.LastStatusCode = res.StatusCode s.LastStatusCode = res.StatusCode
if s.Expected.String != "" { if s.Expected.String != "" {
if err != nil {
utils.Log(2, err)
}
match, err := regexp.MatchString(s.Expected.String, string(content)) match, err := regexp.MatchString(s.Expected.String, string(content))
if err != nil { 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 !match {
if record { if record {

View File

@ -11,8 +11,8 @@
<tr> <tr>
<th scope="col">Name</th> <th scope="col">Name</th>
<th scope="col" class="d-none d-md-table-cell">Status</th> <th scope="col" class="d-none d-md-table-cell">Status</th>
<th scope="col">Visibility</th> <th scope="col" class="d-none d-md-table-cell">Visibility</th>
<th scope="col">Group</th> <th scope="col" class="d-none d-md-table-cell">Group</th>
<th scope="col"></th> <th scope="col"></th>
</tr> </tr>
</thead> </thead>

View File

@ -1,6 +1,6 @@
// Code generated by go generate; DO NOT EDIT. // Code generated by go generate; DO NOT EDIT.
// This file was generated by robots at // 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. // This contains the most recently Markdown source for the Statping Wiki.
package source package source

View File

@ -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 // 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 { func Log(level int, err interface{}) error {
if disableLogs {
return nil
}
pushLastLine(err) pushLastLine(err)
var outErr error var outErr error
switch level { switch level {

View File

@ -36,7 +36,8 @@ import (
var ( var (
// Directory returns the current path or the STATPING_DIR environment variable // 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 // 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 Directory = dir
} }
logger := os.Getenv("DISABLE_LOGS")
disableLogs, _ = strconv.ParseBool(logger)
} }
// ToInt converts a int to a string // ToInt converts a int to a string

View File

@ -1 +1 @@
0.80.58 0.80.59