log/linux.go

41 lines
839 B
Go
Raw Normal View History

2019-06-16 09:08:38 -05:00
// +build linux,go1.7
// put stuff in here that you only want compiled under linux
package log
import origlog "log"
import "os"
import "os/signal"
import "syscall"
// import "runtime"
// import "time"
// import "reflect"
// import "git.wit.com/wit/shell"
// import "github.com/davecgh/go-spew/spew"
import "github.com/sirupsen/logrus"
import "github.com/wercker/journalhook"
var sigChan chan os.Signal
func init() {
origlog.Println("LINUX LOG() INIT()")
systemdlog = logrus.New()
journalhook.Enable()
systemdlog.Println("LINUX LOG() INIT()")
systemdlog.Println("LINUX LOG() INIT()")
}
func handleSignal(err interface{}, ret int) {
origlog.Println("handleSignal() only should be compiled on linux")
sigChan = make(chan os.Signal, 3)
signal.Notify(sigChan, syscall.SIGUSR1)
}
func UseJournalctl() {
journalhook.Enable()
}