Creating ohif-studies package to deal with studies browsing
This commit is contained in:
1 parent
956e6da0b3
commit
0b51a53976
28 files changed
+323
-83
No files matched your search
@@ -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`);
|
||||
};
|
||||
Reference in new issue
Block a user