This commit is contained in:
xtaci
2018-06-28 19:25:37 +08:00
parent e3ab00cf5b
commit 8f8d762742
2 changed files with 11 additions and 13 deletions
+5 -6
View File
@@ -19,7 +19,7 @@ import (
kcp "github.com/xtaci/kcp-go"
"github.com/xtaci/smux"
"path/filepath"
"path/filepath"
)
var (
@@ -478,11 +478,10 @@ func snmpLogger(path string, interval int) {
for {
select {
case <-ticker.C:
// TODO : Please review
// split path into dirname and filename
logdir, logfile := filepath.Split(path)
// only format logfile
f, err := os.OpenFile(logdir + time.Now().Format(logfile), os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
// split path into dirname and filename
logdir, logfile := filepath.Split(path)
// only format logfile
f, err := os.OpenFile(logdir+time.Now().Format(logfile), os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
if err != nil {
log.Println(err)
return
+6 -7
View File
@@ -15,12 +15,12 @@ import (
"golang.org/x/crypto/pbkdf2"
"path/filepath"
"github.com/golang/snappy"
"github.com/urfave/cli"
kcp "github.com/xtaci/kcp-go"
"github.com/xtaci/smux"
"path/filepath"
)
var (
@@ -402,11 +402,10 @@ func snmpLogger(path string, interval int) {
for {
select {
case <-ticker.C:
// TODO: Please review
// split path into dirname and filename
logdir, logfile := filepath.Split(path)
// only format logfile
f, err := os.OpenFile(logdir + time.Now().Format(logfile), os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
// split path into dirname and filename
logdir, logfile := filepath.Split(path)
// only format logfile
f, err := os.OpenFile(logdir+time.Now().Format(logfile), os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
if err != nil {
log.Println(err)
return