Add logs to service

This commit is contained in:
2024-08-19 11:35:31 +02:00
parent 5b00b68a88
commit e33dea3e4b

View File

@@ -2,6 +2,7 @@ package main
import (
"fmt"
"log"
"time"
)
@@ -14,6 +15,7 @@ const paymentColumns = "id, billid, monthFor, paymentDate"
const billColumns = "id, name"
func (s *BillService) GetPaymentsForDate(date time.Time) ([]Payment, error) {
log.Printf("GetPaymentsForDate for %v", date)
res := []Payment{}
if s == nil {
return res, fmt.Errorf("calling GetPaymentsFor on nil BillService")
@@ -45,6 +47,7 @@ WHERE monthFor = date(strftime('%%Y-%%m-01', ?));
}
func (s *BillService) GetPaymentForBillAndDate(billid int64, date time.Time) (Payment, error) {
log.Printf("GetPaymentForBillAndDate for %d and %s", billid, date)
res := Payment{}
if s == nil {
return res, fmt.Errorf("calling GetPaymentsFor on nil BillService")
@@ -68,6 +71,7 @@ WHERE billid = ? AND monthFor = date(strftime('%%Y-%%m-01', ?));
}
func (s *BillService) GetAllBills() ([]Bill, error) {
log.Printf("GetAllBills")
res := []Bill{}
if s == nil {
return res, fmt.Errorf("calling GetAllBills on nil BillService")
@@ -100,6 +104,7 @@ func (s *BillService) GetAllBills() ([]Bill, error) {
}
func (s *BillService) MarkPaid(billid int64, monthFor time.Time, when time.Time) (Payment, error) {
log.Printf("MarkPaid for %d, %v and %v", billid, monthFor, when)
res := Payment{}
if s == nil {
return res, fmt.Errorf("calling MarkPaid on nil BillService")