comparison pkg/controllers/manualimports.go @ 5490:5f47eeea988d logging

Use own logging package.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 20 Sep 2021 17:45:39 +0200
parents 4394daeea96a
children 6270951dda28
comparison
equal deleted inserted replaced
5488:a726a92ea5c9 5490:5f47eeea988d
13 // * Raimund Renkert <raimund.renkert@intevation.de> 13 // * Raimund Renkert <raimund.renkert@intevation.de>
14 14
15 package controllers 15 package controllers
16 16
17 import ( 17 import (
18 "log"
19 "net/http" 18 "net/http"
20 "time" 19 "time"
21 20
22 "github.com/gorilla/mux" 21 "github.com/gorilla/mux"
23 22
24 "gemma.intevation.de/gemma/pkg/auth" 23 "gemma.intevation.de/gemma/pkg/auth"
25 "gemma.intevation.de/gemma/pkg/common" 24 "gemma.intevation.de/gemma/pkg/common"
26 "gemma.intevation.de/gemma/pkg/imports" 25 "gemma.intevation.de/gemma/pkg/imports"
26 "gemma.intevation.de/gemma/pkg/log"
27 "gemma.intevation.de/gemma/pkg/models" 27 "gemma.intevation.de/gemma/pkg/models"
28 28
29 mw "gemma.intevation.de/gemma/pkg/middleware" 29 mw "gemma.intevation.de/gemma/pkg/middleware"
30 ) 30 )
31 31
32 func importModel(req *http.Request) interface{} { 32 func importModel(req *http.Request) interface{} {
33 kind := mux.Vars(req)["kind"] 33 kind := mux.Vars(req)["kind"]
34 ctor := imports.ImportModelForJobKind(imports.JobKind(kind)) 34 ctor := imports.ImportModelForJobKind(imports.JobKind(kind))
35 if ctor == nil { 35 if ctor == nil {
36 log.Printf("error: Unknown job kind '%s'.\n", kind) 36 log.Errorf("unknown job kind '%s'.\n", kind)
37 panic(http.ErrAbortHandler) 37 panic(http.ErrAbortHandler)
38 } 38 }
39 return ctor() 39 return ctor()
40 } 40 }
41 41
92 serialized, 92 serialized,
93 ); err != nil { 93 ); err != nil {
94 return 94 return
95 } 95 }
96 96
97 log.Printf("info: added import #%d to queue\n", jobID) 97 log.Infof("added import #%d to queue\n", jobID)
98 98
99 result := struct { 99 result := struct {
100 ID int64 `json:"id"` 100 ID int64 `json:"id"`
101 }{ 101 }{
102 ID: jobID, 102 ID: jobID,