Skip to content

Commit

Permalink
Add debugging information to troubleshoot shifty issues
Browse files Browse the repository at this point in the history
  • Loading branch information
bmealhouse committed Jul 14, 2019
1 parent 6244c42 commit 4fa0dae
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.1.1] - 2019-07-14

### Added

- Add debugging information to troubleshoot shifty issues

## [1.1.0] - 2019-07-14

### Added
Expand Down
23 changes: 21 additions & 2 deletions src/shift-interval/ipc-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ export async function start({
);
}


const shiftColorThemeIntervalEnabled =
shiftColorThemeIntervalMin > 0;

Expand Down Expand Up @@ -223,6 +222,7 @@ export async function start({
resolve(connection);
});

let hasDebuggedFontFamilyStatus = false;
function calculateRemainingTime(now: number): string {
const {
shiftColorThemeIntervalMin,
Expand Down Expand Up @@ -263,7 +263,26 @@ export async function start({
if (shiftFontFamilyRemainingSeconds < shiftColorThemeRemainingSeconds) {
min = Math.max(0, Math.floor(shiftFontFamilyRemainingSeconds / 60));
sec = Math.max(0, shiftFontFamilyRemainingSeconds % 60);
return `${pad0(min)}:${pad0(sec)} (font family)`;
let calculationResult = `${pad0(min)}:${pad0(sec)} (font family)`;

if (
!hasDebuggedFontFamilyStatus &&
process.env.SHIFTY_DEBUG === 'true'
) {
console.log({
now,
shiftColorThemeIntervalMs,
shiftFontFamilyIntervalMs,
lastColorThemeShiftTime,
lastFontFamilyShiftTime,
shiftColorThemeRemainingSeconds,
shiftFontFamilyRemainingSeconds,
calculationResult,
});
hasDebuggedFontFamilyStatus = true;
}

return calculationResult;
}
}

Expand Down

0 comments on commit 4fa0dae

Please sign in to comment.