Skip to content

Commit

Permalink
dev
Browse files Browse the repository at this point in the history
  • Loading branch information
eGavr committed Feb 24, 2020
1 parent 0074a3b commit 6ac4f85
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ const parseConfig = require('./config');

const UNKNOWN_PLUGIN_NAME = 'unknown-plugin-name';

const DATA = {};

module.exports = (hermione, opts) => {
const config = parseConfig(opts);

Expand All @@ -30,7 +32,18 @@ module.exports = (hermione, opts) => {
if (isPromise(res)) {
return res.finally(() => log(pluginName, event))
} else {
const start = new Date().getTime();
log(pluginName, event);
const end = new Date().getTime();

const id = `${process.pid}:${pluginName}:${event}`;

if (!DATA[id]) {
DATA[id] = 0;
}

DATA[id] += end - start;
console.log(`${id}:DATA[id]`)
}
}

Expand Down

0 comments on commit 6ac4f85

Please sign in to comment.