Browse Source

Write log into separate log-file

feature/update-route-registration
Fabian Vowie 3 years ago
parent
commit
5da9e11654
No known key found for this signature in database GPG Key ID: C27317C33B27C410
  1. 3
      .gitignore
  2. 9
      main.go

3
.gitignore

@ -15,4 +15,5 @@
go.work
# Lithium specific
settings.json
settings.json
lithium.log

9
main.go

@ -149,8 +149,15 @@ func RegisterRoutes(r *mux.Router, pipelines []pipelines.IPipeline, storageProvi
}
func main() {
logFile, err := os.OpenFile("lithium.log", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
if err == nil {
multiWriter := io.MultiWriter(os.Stdout, logFile)
logrus.SetOutput(multiWriter)
} else {
logrus.SetOutput(os.Stdout)
}
logrus.SetFormatter(&logrus.JSONFormatter{})
logrus.SetOutput(os.Stdout)
appSettings, err := settings.LoadSettings(afero.NewOsFs())
if err != nil {

Loading…
Cancel
Save