OSDN Git Service

writer close fix_log
authorwyjDoraemon <wyjDoraemon@163.com>
Tue, 13 Aug 2019 07:21:48 +0000 (15:21 +0800)
committerwyjDoraemon <wyjDoraemon@163.com>
Tue, 13 Aug 2019 07:21:48 +0000 (15:21 +0800)
log/log.go
p2p/security/security.go

index c766483..9136f99 100644 (file)
@@ -68,15 +68,17 @@ func (hook *BtmHook) ioWrite(entry *logrus.Entry) error {
                return err
        }
 
                return err
        }
 
-       _, err = writer.Write(msg)
-       return err
+       if _, err := writer.Write(msg); err != nil {
+               return err
+       }
+       return writer.Close()
 }
 
 func clearLockFiles(logPath string) error {
        files, err := ioutil.ReadDir(logPath)
        if os.IsNotExist(err) {
                return nil
 }
 
 func clearLockFiles(logPath string) error {
        files, err := ioutil.ReadDir(logPath)
        if os.IsNotExist(err) {
                return nil
-       }else if err != nil {
+       } else if err != nil {
                return err
        }
 
                return err
        }
 
index 7c9e945..47d5128 100644 (file)
@@ -6,7 +6,7 @@ import (
        cfg "github.com/vapor/config"
 )
 
        cfg "github.com/vapor/config"
 )
 
-const logModule = "p2p/security"
+const logModule = "p2pSecurity"
 
 type Security struct {
        filter        *PeerFilter
 
 type Security struct {
        filter        *PeerFilter