From 99e50b1062305668b18efb967f698b3b974e7d64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferdinand=20M=C3=BCtsch?= Date: Sun, 20 Nov 2022 10:12:34 +0100 Subject: [PATCH] chore: logging --- services/misc.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/services/misc.go b/services/misc.go index 5d2f72f..7f178b7 100644 --- a/services/misc.go +++ b/services/misc.go @@ -33,6 +33,7 @@ func NewMiscService(userService IUserService, summaryService ISummaryService, ke } func (srv *MiscService) ScheduleCountTotalTime() { + logbuch.Info("scheduling total time counting") if _, err := srv.queueDefault.DispatchEvery(srv.CountTotalTime, 1*time.Hour); err != nil { config.Log().Error("failed to schedule user counting jobs, %v", err) } @@ -41,7 +42,7 @@ func (srv *MiscService) ScheduleCountTotalTime() { func (srv *MiscService) CountTotalTime() { users, err := srv.userService.GetAll() if err != nil { - logbuch.Error("failed to fetch users for time counting, %v", err) + config.Log().Error("failed to fetch users for time counting, %v", err) } var totalTime time.Duration = 0 @@ -65,14 +66,14 @@ func (srv *MiscService) CountTotalTime() { Key: config.KeyLatestTotalTime, Value: totalTime.String(), }); err != nil { - logbuch.Error("failed to save total time count: %v", err) + config.Log().Error("failed to save total time count: %v", err) } if err := srv.keyValueService.PutString(&models.KeyStringValue{ Key: config.KeyLatestTotalUsers, Value: strconv.Itoa(len(users)), }); err != nil { - logbuch.Error("failed to save total users count: %v", err) + config.Log().Error("failed to save total users count: %v", err) } } else { config.Log().Error("waiting for user counting jobs timed out")