Add AMGR prefix to log messages for consistency.
This commit is contained in:
parent
a5cc716940
commit
94c795dec4
1 changed files with 7 additions and 7 deletions
|
@ -296,7 +296,7 @@ func (a *AddrManager) savePeers() {
|
||||||
|
|
||||||
w, err := os.Create(filePath)
|
w, err := os.Create(filePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Error opening file: ", filePath, err)
|
log.Error("[AMGR] Error opening file: ", filePath, err)
|
||||||
}
|
}
|
||||||
enc := json.NewEncoder(w)
|
enc := json.NewEncoder(w)
|
||||||
defer w.Close()
|
defer w.Close()
|
||||||
|
@ -312,11 +312,11 @@ func (a *AddrManager) loadPeers() {
|
||||||
|
|
||||||
_, err := os.Stat(filePath)
|
_, err := os.Stat(filePath)
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
log.Debugf("%s does not exist.\n", filePath)
|
log.Debugf("[AMGR] %s does not exist.", filePath)
|
||||||
} else {
|
} else {
|
||||||
r, err := os.Open(filePath)
|
r, err := os.Open(filePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Error opening file: ", filePath, err)
|
log.Error("[AMGR] Error opening file: ", filePath, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer r.Close()
|
defer r.Close()
|
||||||
|
@ -325,10 +325,10 @@ func (a *AddrManager) loadPeers() {
|
||||||
dec := json.NewDecoder(r)
|
dec := json.NewDecoder(r)
|
||||||
err = dec.Decode(&inList)
|
err = dec.Decode(&inList)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Error reading:", filePath, err)
|
log.Error("[AMGR] Error reading:", filePath, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Debug("Adding ", len(inList.AddrList), " saved peers.")
|
log.Debug("[AMGR] Adding ", len(inList.AddrList), " saved peers.")
|
||||||
if len(inList.AddrList) > 0 {
|
if len(inList.AddrList) > 0 {
|
||||||
for _, ip := range inList.AddrList {
|
for _, ip := range inList.AddrList {
|
||||||
a.AddAddressByIP(ip)
|
a.AddAddressByIP(ip)
|
||||||
|
@ -408,12 +408,12 @@ func (a *AddrManager) AddAddressByIP(addrIP string) {
|
||||||
na.Timestamp = time.Now()
|
na.Timestamp = time.Now()
|
||||||
na.IP = net.ParseIP(addr)
|
na.IP = net.ParseIP(addr)
|
||||||
if na.IP == nil {
|
if na.IP == nil {
|
||||||
log.Error("Invalid ip address:", addr)
|
log.Error("[AMGR] Invalid ip address:", addr)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
port, err := strconv.ParseUint(portStr, 10, 0)
|
port, err := strconv.ParseUint(portStr, 10, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Invalid port: ", portStr, err)
|
log.Error("[AMGR] Invalid port: ", portStr, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
na.Port = uint16(port)
|
na.Port = uint16(port)
|
||||||
|
|
Loading…
Reference in a new issue