Skip to content

Commit

Permalink
Extract log sender building into a function
Browse files Browse the repository at this point in the history
  • Loading branch information
mhuffnagle committed Oct 10, 2018
1 parent 31324d7 commit 7dd0fc6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ function getFunctionName(lambdaId) {
return lambdaId;
}

// eslint-disable-next-line require-jsdoc
const getLogSenderFromLambdaId = (lambdaId) =>
`cumulus-ecs-task/${getFunctionName(lambdaId)}`;

/**
* Download a URL to file
*
Expand Down Expand Up @@ -269,7 +273,7 @@ async function runTask(options) {
const taskDir = options.taskDirectory;
const workDir = options.workDirectory;

log.sender = `cumulus-ecs-task/${getFunctionName(lambdaArn)}`;
log.sender = getLogSenderFromLambdaId(lambdaArn);

// the cumulus-message-adapter dir is in an unexpected place,
// so tell the adapter where to find it
Expand Down Expand Up @@ -317,7 +321,7 @@ async function runServiceFromSQS(options) {
const workDir = options.workDirectory;
const runForever = options.runForever || true;

log.sender = `cumulus-ecs-task/${getFunctionName(lambdaArn)}`;
log.sender = getLogSenderFromLambdaId(lambdaArn);

// the cumulus-message-adapter dir is in an unexpected place,
// so tell the adapter where to find it
Expand Down Expand Up @@ -393,7 +397,7 @@ async function runServiceFromActivity(options) {

let runForever = true;

log.sender = `cumulus-ecs-task/${getFunctionName(lambdaArn)}`;
log.sender = getLogSenderFromLambdaId(lambdaArn);

// the cumulus-message-adapter dir is in an unexpected place,
// so tell the adapter where to find it
Expand Down

0 comments on commit 7dd0fc6

Please sign in to comment.