mirror of
https://github.com/yusing/godoxy.git
synced 2026-01-15 08:03:37 +01:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4df31263b5 | ||
|
|
9eae809690 | ||
|
|
f1ba554a24 |
@@ -7,6 +7,7 @@ import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/shirou/gopsutil/v4/cpu"
|
||||
@@ -71,6 +72,10 @@ func _() { // check if this behavior is not changed
|
||||
var _ sensors.Warnings = disk.Warnings{}
|
||||
}
|
||||
|
||||
func isNoDataAvailable(err error) bool {
|
||||
return errors.Is(err, syscall.ENODATA)
|
||||
}
|
||||
|
||||
func getSystemInfo(ctx context.Context, lastResult *SystemInfo) (*SystemInfo, error) {
|
||||
errs := gperr.NewBuilder("failed to get system info")
|
||||
var s SystemInfo
|
||||
@@ -99,6 +104,9 @@ func getSystemInfo(ctx context.Context, lastResult *SystemInfo) (*SystemInfo, er
|
||||
warnings := new(warning.Warning)
|
||||
if errors.As(err, &warnings) {
|
||||
for _, warning := range warnings.List {
|
||||
if isNoDataAvailable(warning) {
|
||||
continue
|
||||
}
|
||||
allWarnings.Add(warning)
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -27,7 +27,7 @@ func NewMiddlewareChain(name string, chain []*Middleware) *Middleware {
|
||||
comp.setParent(m)
|
||||
}
|
||||
|
||||
if common.IsDebug {
|
||||
if common.IsTrace {
|
||||
for _, child := range chain {
|
||||
child.enableTrace()
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ func (msg *LogMessage) notify(ctx context.Context, provider Provider) error {
|
||||
defer resp.Body.Close()
|
||||
|
||||
switch resp.StatusCode {
|
||||
case http.StatusOK, http.StatusCreated, http.StatusAccepted:
|
||||
case http.StatusOK, http.StatusCreated, http.StatusAccepted, http.StatusNoContent:
|
||||
body, _ := io.ReadAll(resp.Body)
|
||||
logging.Debug().
|
||||
Str("provider", provider.GetName()).
|
||||
|
||||
Reference in New Issue
Block a user