aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/ngaut/log/crash_unix.go
blob: 5b9bc23aa2baf06de7543a35a05a22ca2c9db7c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// +build freebsd openbsd netbsd dragonfly linux

package log

import (
	"log"
	"os"
	"syscall"
)

func CrashLog(file string) {
	f, err := os.OpenFile(file, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666)
	if err != nil {
		log.Println(err.Error())
	} else {
		syscall.Dup3(int(f.Fd()), 2, 0)
	}
}