Skip to content

Commit

Permalink
add logger
Browse files Browse the repository at this point in the history
  • Loading branch information
Tzipi-kaltura committed Nov 19, 2024
1 parent 30b8f1f commit 032d758
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/utils/duration-humanizer.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import * as humanizeDuration from 'humanize-duration';
import getLogger from './logger';

let logger;

const getDurationAsText = (seconds: number, locale: string, round: boolean = false): string | undefined => {
const logger = getLogger('DurationHumanizer');
try {
const durationHumanizer = getDurationHumanizer(locale);
if (durationHumanizer) {
Expand All @@ -13,6 +14,9 @@ const getDurationAsText = (seconds: number, locale: string, round: boolean = fal
}
}
} catch (e: any) {
if (!logger) {
logger = getLogger('DurationHumanizer');
}
logger.log(e);
}
};
Expand Down

0 comments on commit 032d758

Please sign in to comment.