mirror of
https://github.com/rancher/os.git
synced 2025-09-04 16:21:07 +00:00
try to simplify logging
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
This commit is contained in:
33
log/log.go
33
log/log.go
@@ -109,29 +109,32 @@ func InitLogger() {
|
|||||||
}
|
}
|
||||||
thisLog := logrus.New()
|
thisLog := logrus.New()
|
||||||
|
|
||||||
filename := "/dev/kmsg"
|
|
||||||
f, err := os.OpenFile(filename, os.O_WRONLY, 0644)
|
|
||||||
if err != nil {
|
|
||||||
logrus.Debugf("error opening /dev/kmsg %s", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Filter what the user sees (info level, unless they set --debug)
|
// Filter what the user sees (info level, unless they set --debug)
|
||||||
stdLogger := logrus.StandardLogger()
|
stdLogger := logrus.StandardLogger()
|
||||||
showuserHook, err := NewShowuserlogHook(stdLogger.Level)
|
showuserHook, err := NewShowuserlogHook(stdLogger.Level)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
f.Close()
|
|
||||||
logrus.Errorf("hook failure %s", err)
|
logrus.Errorf("hook failure %s", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// We're all set up, now we can make it global
|
// TODO: look into containerized syslog
|
||||||
appLog = thisLog
|
//filename := "/dev/kmsg"
|
||||||
userHook = showuserHook
|
filename := "/var/log/log"
|
||||||
|
f, err := os.OpenFile(filename, os.O_WRONLY, 0644)
|
||||||
|
if err != nil {
|
||||||
|
logrus.Debugf("error opening %s: %s", filename, err)
|
||||||
|
} else {
|
||||||
|
// We're all set up, now we can make it global
|
||||||
|
appLog = thisLog
|
||||||
|
userHook = showuserHook
|
||||||
|
|
||||||
thisLog.Hooks.Add(showuserHook)
|
thisLog.Hooks.Add(showuserHook)
|
||||||
logrus.StandardLogger().Hooks.Add(showuserHook)
|
logrus.StandardLogger().Hooks.Add(showuserHook)
|
||||||
thisLog.Out = f
|
|
||||||
logrus.SetOutput(f)
|
thisLog.Out = f
|
||||||
thisLog.Level = logrus.DebugLevel
|
logrus.SetOutput(f)
|
||||||
|
thisLog.Level = logrus.DebugLevel
|
||||||
|
}
|
||||||
|
|
||||||
pwd, err := os.Getwd()
|
pwd, err := os.Getwd()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@@ -35,7 +35,6 @@ cp /usr/lib/ISOLINUX/isolinux.bin ${CD}/boot/isolinux/
|
|||||||
cp /usr/lib/syslinux/modules/bios/ldlinux.c32 ${CD}/boot/isolinux/
|
cp /usr/lib/syslinux/modules/bios/ldlinux.c32 ${CD}/boot/isolinux/
|
||||||
# add the installer image to the iso for non-network / dev/test
|
# add the installer image to the iso for non-network / dev/test
|
||||||
cp ${ARTIFACTS}/installer.tar ${CD}/rancheros/
|
cp ${ARTIFACTS}/installer.tar ${CD}/rancheros/
|
||||||
cp assets/bootinfoscript ${CD}/rancheros/
|
|
||||||
gzip ${CD}/rancheros/installer.tar
|
gzip ${CD}/rancheros/installer.tar
|
||||||
cd ${CD} && xorriso \
|
cd ${CD} && xorriso \
|
||||||
-as mkisofs \
|
-as mkisofs \
|
||||||
|
Reference in New Issue
Block a user