diff --git a/log/input.go b/log/input.go index d67e360..080f783 100644 --- a/log/input.go +++ b/log/input.go @@ -22,6 +22,15 @@ func log_fastcheck(level severity) bool { func log(level severity, msg string) { + if !started.IsSet() { + // resouce intense, but keeps logs before logging started. + go func(){ + time.Sleep(1 * time.Second) + log(level, msg) + }() + return + } + // check if level is enabled if !fileLevelsActive.IsSet() && uint32(level) < atomic.LoadUint32(logLevel) { return diff --git a/log/logging.go b/log/logging.go index a053cf0..15d8f60 100644 --- a/log/logging.go +++ b/log/logging.go @@ -138,10 +138,10 @@ func Start() error { SetFileLevels(newFileLevels) } + fmt.Println(fmt.Sprintf("%s%s ▶ BOF%s", InfoLevel.color(), time.Now().Format("060102 15:04:05.000"), endColor())) go writer() - Info("logging: started") - return nil + return nil } // Shutdown writes remaining log lines and then stops the logger. diff --git a/log/output.go b/log/output.go index 7d4cb53..2cf9ff5 100644 --- a/log/output.go +++ b/log/output.go @@ -43,13 +43,7 @@ func writer() { case line = <-logBuffer: writeLine(line) case <-time.After(10 * time.Millisecond): - writeLine(&logLine{ - "===== LOGGING STOPPED =====", - WarningLevel, - time.Now(), - "", - 0, - }) + fmt.Println(fmt.Sprintf("%s%s ◀ EOF%s", InfoLevel.color(), time.Now().Format("060102 15:04:05.000"), endColor())) return } }