paniclog_linux.go 322 B

12345678910111213141516171819
  1. // Log the panic under unix to the log file
  2. //+build linux
  3. package tools
  4. import (
  5. "log"
  6. "os"
  7. "syscall"
  8. )
  9. // redirectStderr to the file passed in
  10. func RedirectStderr(f *os.File) {
  11. err := syscall.Dup2(int(f.Fd()), int(os.Stderr.Fd()))
  12. if err != nil {
  13. log.Printf("Failed to redirect stderr to file: %v", err)
  14. }
  15. }