chore: tweak debugging output

This commit is contained in:
2019-02-19 15:15:37 -07:00
parent 5c842eccff
commit 59a3ae4be7
2 changed files with 27 additions and 15 deletions

View File

@@ -1,5 +1,10 @@
import logger from './logger.mjs';
function truncate(str, len = 26) {
if (str.length <= len) return str;
return `${str.slice(0, len)}...`;
}
export default async function getEvents(repo, { body, actor } = {}) {
const events = await repo.events.fetch();
@@ -32,14 +37,12 @@ export default async function getEvents(repo, { body, actor } = {}) {
`SKIP EVENT ${isComment ? `#${comment.payload.issue.number}` : comment.id}: ${
comment.type
} ${comment.payload.action} by ${comment.actor.login}`,
isComment && !bodyMatch && `(${comment.payload.comment.body.slice(0, 30)})`
isComment && !bodyMatch && `(${truncate(comment.payload.comment.body)})`
);
}
return false;
}
logger.debug(`PROCESS #${comment.payload.issue.number}`);
return {
id: comment.id,
number: comment.payload.issue.number,