mirror of
https://github.com/XrayR-project/XrayR.git
synced 2025-07-28 15:38:35 +00:00
Replace standard log package with logrus
The standard "log" package was replaced by the structured logger "github.com/sirupsen/logrus" for better log control in various files. This change will allow to tailor the logging information more precisely and make logs easier to read and analyze. All calls of standard log methods were replaced by their logrus counterparts.
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"regexp"
|
||||
"strconv"
|
||||
@@ -13,6 +12,8 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/bitly/go-simplejson"
|
||||
"github.com/go-resty/resty/v2"
|
||||
"github.com/sagernet/sing-shadowsocks/shadowaead_2022"
|
||||
@@ -57,7 +58,7 @@ func New(apiConfig *api.Config) *APIClient {
|
||||
log.Print(v.Err)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
// Create Key for each requests
|
||||
client.SetQueryParams(map[string]string{
|
||||
"node_id": strconv.Itoa(apiConfig.NodeID),
|
||||
@@ -163,7 +164,7 @@ func (c *APIClient) GetNodeInfo() (nodeInfo *api.NodeInfo, err error) {
|
||||
}).
|
||||
ForceContentType("application/json").
|
||||
Get(c.APIHost)
|
||||
|
||||
|
||||
// Etag identifier for a specific version of a resource. StatusCode = 304 means no changed
|
||||
if res.StatusCode() == 304 {
|
||||
return nil, errors.New(api.NodeNotModified)
|
||||
@@ -217,7 +218,7 @@ func (c *APIClient) GetUserList() (UserList *[]api.UserInfo, err error) {
|
||||
}).
|
||||
ForceContentType("application/json").
|
||||
Get(c.APIHost)
|
||||
|
||||
|
||||
// Etag identifier for a specific version of a resource. StatusCode = 304 means no changed
|
||||
if res.StatusCode() == 304 {
|
||||
return nil, errors.New(api.UserNotModified)
|
||||
@@ -426,7 +427,7 @@ func (c *APIClient) ParseV2rayNodeResponse(nodeInfoResponse *simplejson.Json) (*
|
||||
var header json.RawMessage
|
||||
var enableTLS bool
|
||||
var enableVless bool
|
||||
var enableReality bool
|
||||
var enableReality bool
|
||||
var alterID uint16 = 0
|
||||
|
||||
tmpInboundInfo := nodeInfoResponse.Get("inbounds").MustArray()
|
||||
@@ -493,4 +494,4 @@ func (c *APIClient) ParseV2rayNodeResponse(nodeInfoResponse *simplejson.Json) (*
|
||||
REALITYConfig: realityConfig,
|
||||
}
|
||||
return nodeInfo, nil
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user