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. 1
      .gitignore
  2. 9
      main.go

1
.gitignore

@ -16,3 +16,4 @@ go.work
# Lithium specific
settings.json
lithium.log

9
main.go

@ -149,8 +149,15 @@ func RegisterRoutes(r *mux.Router, pipelines []pipelines.IPipeline, storageProvi
}
func main() {
logrus.SetFormatter(&logrus.JSONFormatter{})
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{})
appSettings, err := settings.LoadSettings(afero.NewOsFs())
if err != nil {

Loading…
Cancel
Save