Mercurial > gemma
comparison pkg/scheduler/boot.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 | 6691bf76af1c |
children |
comparison
equal
deleted
inserted
replaced
5488:a726a92ea5c9 | 5490:5f47eeea988d |
---|---|
14 package scheduler | 14 package scheduler |
15 | 15 |
16 import ( | 16 import ( |
17 "context" | 17 "context" |
18 "database/sql" | 18 "database/sql" |
19 "log" | |
20 | 19 |
21 "gemma.intevation.de/gemma/pkg/auth" | 20 "gemma.intevation.de/gemma/pkg/auth" |
22 "gemma.intevation.de/gemma/pkg/config" | 21 "gemma.intevation.de/gemma/pkg/config" |
22 "gemma.intevation.de/gemma/pkg/log" | |
23 ) | 23 ) |
24 | 24 |
25 const ( | 25 const ( |
26 bootRole = "sys_admin" | 26 bootRole = "sys_admin" |
27 | 27 |
48 | 48 |
49 // boot starts the scheduler with the configurations from | 49 // boot starts the scheduler with the configurations from |
50 // the database which have a schedule. | 50 // the database which have a schedule. |
51 func boot() { | 51 func boot() { |
52 config.WaitReady() | 52 config.WaitReady() |
53 log.Println("info: booting scheduler from database.") | 53 log.Infoln("booting scheduler from database.") |
54 ctx := context.Background() | 54 ctx := context.Background() |
55 err := auth.RunAs( | 55 err := auth.RunAs( |
56 ctx, bootRole, | 56 ctx, bootRole, |
57 func(conn *sql.Conn) error { | 57 func(conn *sql.Conn) error { |
58 rows, err := conn.QueryContext(ctx, selectImportConfSQL) | 58 rows, err := conn.QueryContext(ctx, selectImportConfSQL) |
82 return err | 82 return err |
83 } | 83 } |
84 return rows.Err() | 84 return rows.Err() |
85 }) | 85 }) |
86 if err != nil { | 86 if err != nil { |
87 log.Printf("error: %v\n", err) | 87 log.Errorf("%v\n", err) |
88 } | 88 } |
89 } | 89 } |
90 | 90 |
91 // ScheduledUserIDs returns the IDs with a schedule for a given user. | 91 // ScheduledUserIDs returns the IDs with a schedule for a given user. |
92 func ScheduledUserIDs( | 92 func ScheduledUserIDs( |