File tree Expand file tree Collapse file tree
git-jaspr/src/main/kotlin/sims/michael/gitjaspr Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,16 +33,23 @@ class TipProvider(
3333 private val logger = LoggerFactory .getLogger(TipProvider ::class .java)
3434 private val json = Json { ignoreUnknownKeys = true }
3535
36+ init {
37+ logger.info(" Using state file {}" , stateFile.absolutePath)
38+ }
39+
3640 /* *
3741 * Returns a tip if it's time to show one, or null otherwise. Updates state as a side effect.
3842 */
3943 fun getNextTip (): String? {
44+ logger.trace(" getNextTip" )
4045 if (tips.isEmpty()) return null
4146
4247 val state = loadState()
48+ logger.trace(" getNextTip state loaded: {}" , state)
4349 val nextCount = state.invocationsSinceLastTip + 1
4450
4551 if (nextCount < TIP_INTERVAL ) {
52+ logger.trace(" Not time to show tip yet, invocationsSinceLastTip: {}" , nextCount)
4653 saveState(state.copy(invocationsSinceLastTip = nextCount))
4754 return null
4855 }
@@ -65,6 +72,7 @@ class TipProvider(
6572 }
6673
6774 private fun saveState (state : TipsState ) {
75+ logger.trace(" Saving tips state: {}" , state)
6876 try {
6977 stateFile.parentFile?.mkdirs()
7078 stateFile.writeText(json.encodeToString(state))
You can’t perform that action at this time.
0 commit comments