Skip to content

Commit

Permalink
add logging to QuarterFunction (#1076)
Browse files Browse the repository at this point in the history
  • Loading branch information
clean-coder authored and MasterEvarior committed Nov 6, 2024
1 parent 66803d3 commit f80fed8
Showing 1 changed file with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import ch.puzzle.okr.util.quarter.generate.QuarterData;
import ch.puzzle.okr.util.quarter.generate.Quarters;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;

Expand All @@ -21,6 +23,7 @@ public class QuarterFunction {
public static final int NEXT_QUARTER_DB_ID = 3;

private static final Map<Integer, QuarterData> QUARTERS = new HashMap<>();
private static final Logger logger = LoggerFactory.getLogger(QuarterFunction.class);

public static void initQuarterData() {
LocalDate now = LocalDate.now();
Expand All @@ -37,27 +40,40 @@ private static void registerCurrentQuarterForDate(LocalDate date, int dbId) {
}

public static String currentQuarterLabel() {
return QUARTERS.get(CURRENT_QUARTER_DB_ID).label();
var label = QUARTERS.get(CURRENT_QUARTER_DB_ID).label();
logger.info("currentQuarterLabel : {}", label);
return label;

}

public static String currentQuarterStartDate() {
return QUARTERS.get(CURRENT_QUARTER_DB_ID).startDateAsIsoString();
var start = QUARTERS.get(CURRENT_QUARTER_DB_ID).startDateAsIsoString();
logger.info("currentQuarterStartDate: {}", start);
return start;
}

public static String currentQuarterEndDate() {
return QUARTERS.get(CURRENT_QUARTER_DB_ID).endDateAsIsoString();
var end = QUARTERS.get(CURRENT_QUARTER_DB_ID).endDateAsIsoString();
logger.info("currentQuarterEndDate : {}", end);
return end;
}

public static String nextQuarterLabel() {
return QUARTERS.get(NEXT_QUARTER_DB_ID).label();
var label = QUARTERS.get(NEXT_QUARTER_DB_ID).label();
logger.info("nextQuarterLabel : {}", label);
return label;
}

public static String nextQuarterStartDate() {
return QUARTERS.get(NEXT_QUARTER_DB_ID).startDateAsIsoString();
var start = QUARTERS.get(NEXT_QUARTER_DB_ID).startDateAsIsoString();
logger.info("nextQuarterStartDate : {}", start);
return start;
}

public static String nextQuarterEndDate() {
return QUARTERS.get(NEXT_QUARTER_DB_ID).endDateAsIsoString();
var end = QUARTERS.get(NEXT_QUARTER_DB_ID).endDateAsIsoString();
logger.info("nextQuarterEndDate : {}", end);
return end;
}

}

0 comments on commit f80fed8

Please sign in to comment.