drop support for windows event log
This commit is contained in:
parent
34bb60ca91
commit
906d69bcd3
2 changed files with 1 additions and 14 deletions
13
log/log.go
13
log/log.go
|
|
@ -8,20 +8,14 @@ import (
|
|||
rotatelogs "github.com/lestrrat-go/file-rotatelogs"
|
||||
"github.com/rifflock/lfshook"
|
||||
"github.com/sirupsen/logrus"
|
||||
"golang.org/x/sys/windows/svc/eventlog"
|
||||
)
|
||||
|
||||
var Log *logrus.Logger
|
||||
var evtlog *eventlog.Log
|
||||
|
||||
func Init() {
|
||||
Log = logrus.New()
|
||||
elog, err := eventlog.Open("Cloud-Init")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
e, err := os.Executable()
|
||||
e, _ := os.Executable()
|
||||
lastBackslashIndex := strings.LastIndex(e, "\\")
|
||||
workdir := e[:lastBackslashIndex]
|
||||
path := workdir + "/cloud-init.log"
|
||||
|
|
@ -46,10 +40,5 @@ func Init() {
|
|||
},
|
||||
&logrus.TextFormatter{},
|
||||
))
|
||||
evtlog = elog
|
||||
Log.SetLevel(logrus.DebugLevel)
|
||||
}
|
||||
|
||||
func Close() {
|
||||
evtlog.Close()
|
||||
}
|
||||
|
|
|
|||
2
main.go
2
main.go
|
|
@ -96,7 +96,6 @@ func application() {
|
|||
if rebootRequired {
|
||||
log.Log.Warn("Reboot is required to apply the changes")
|
||||
if len(os.Args) > 1 && os.Args[1] == "firstboot" {
|
||||
log.Close()
|
||||
os.Exit(1) // Exit 1 means, reboot the system and then continue https://learn.microsoft.com/en-us/windows-hardware/customize/desktop/unattend/microsoft-windows-deployment-runsynchronous-runsynchronouscommand-willreboot
|
||||
} else if config.Configuration.RebootIfRequired {
|
||||
windows.Reboot()
|
||||
|
|
@ -104,7 +103,6 @@ func application() {
|
|||
}
|
||||
|
||||
log.Log.Info("Done executing Cloud-Init")
|
||||
log.Close()
|
||||
os.Exit(0)
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue