release v0.0.4

This commit is contained in:
2019-11-08 17:45:09 +08:00
parent b3fbc466f1
commit 8dcedb0ce7
7 changed files with 26 additions and 35 deletions

View File

@@ -6,15 +6,13 @@ import (
"log"
"os"
"syscall"
"github.com/pkg/errors"
)
// NewCrashLog set crash log
func NewCrashLog(file string) {
f, err := os.OpenFile(file, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666)
if err != nil {
log.Fatalf("open crash log file error. %v", errors.WithStack(err))
log.Fatalf("open crash log file error. %v", err)
} else {
_ = syscall.Dup2(int(f.Fd()), 2)
}

View File

@@ -6,15 +6,13 @@ import (
"log"
"os"
"syscall"
"github.com/pkg/errors"
)
// NewCrashLog set crash log
func NewCrashLog(file string) {
f, err := os.OpenFile(file, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666)
if err != nil {
log.Fatalf("open crash log file error. %v", errors.WithStack(err))
log.Fatalf("open crash log file error. %v", err)
} else {
_ = syscall.Dup3(int(f.Fd()), 2, 0)
}

View File

@@ -6,8 +6,6 @@ import (
"log"
"os"
"syscall"
"github.com/pkg/errors"
)
var (
@@ -34,7 +32,7 @@ func NewCrashLog(file string) {
} else {
err = setStdHandle(syscall.STD_ERROR_HANDLE, syscall.Handle(f.Fd()))
if err != nil {
log.Fatalf("open crash log file error. %v", errors.WithStack(err))
log.Fatalf("open crash log file error. %v", err)
}
}
}