github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/cmd/pyroscope/main_windows.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"os"
     6  
     7  	"github.com/kardianos/service"
     8  	"golang.org/x/sys/windows/svc/eventlog"
     9  )
    10  
    11  func fatalf(format string, args ...interface{}) {
    12  	msg := fmt.Sprintf(format, args...)
    13  	if service.Interactive() {
    14  		_, _ = fmt.Fprint(os.Stderr, msg)
    15  		os.Exit(1)
    16  	}
    17  	log, err := eventlog.Open("Pyroscope")
    18  	if err == nil {
    19  		err = log.Error(1, msg)
    20  	}
    21  	if err != nil {
    22  		panic(msg)
    23  	}
    24  	os.Exit(1)
    25  }