Creating ohif-studies package to deal with studies browsing

This commit is contained in:
Bruno Alves de Faria committed 2017-10-25 22:09:08 -02:00
1 parent 956e6da0b3
commit 0b51a53976
28 files changed
+323 -83

No files matched your search

+19
View File
@@ -7,3 +7,22 @@ const defaultLevel = Meteor.isProduction ? 'ERROR' : 'TRACE';
// Create package logger using loglevel
OHIF.log = loglevel.getLogger('OHIF');
OHIF.log.setLevel(defaultLevel);
// Add time and timeEnd to OHIF.log namespace
const times = new Map();
// Register the time method
OHIF.log.time = givenKey => {
const key = typeof givenKey === 'undefined' ? 'default' : givenKey;
times.set(key, new Date().getTime());
};
// Register the timeEnd method
OHIF.log.timeEnd = givenKey => {
const key = typeof givenKey === 'undefined' ? 'default' : givenKey;
const now = new Date().getTime();
const last = times.get(key) || now;
times.delete(key);
const duration = now - last;
OHIF.log.info(`${key}: ${duration}ms`);
};