Endpoints for audiences CRUD (#3861)

This commit is contained in:
Antonio Davi Macedo Coelho de Castro
2017-06-21 02:54:13 -03:00
committed by Natan Rolnik
parent e94991b368
commit 4509d25471
11 changed files with 448 additions and 74 deletions

View File

@@ -128,26 +128,29 @@ export class FunctionsRouter extends PromiseRouter {
var response = FunctionsRouter.createResponseObject((result) => {
try {
const cleanResult = logger.truncateLogMessage(JSON.stringify(result.response.result));
logger.info(`Ran cloud function ${functionName} for user ${userString} `
+ `with:\n Input: ${cleanInput }\n Result: ${cleanResult }`, {
functionName,
params,
user: userString,
});
logger.info(
`Ran cloud function ${functionName} for user ${userString} with:\n Input: ${cleanInput }\n Result: ${cleanResult }`,
{
functionName,
params,
user: userString,
}
);
resolve(result);
} catch (e) {
reject(e);
}
}, (error) => {
try {
logger.error(`Failed running cloud function ${functionName} for `
+ `user ${userString} with:\n Input: ${cleanInput}\n Error: `
+ JSON.stringify(error), {
functionName,
error,
params,
user: userString
});
logger.error(
`Failed running cloud function ${functionName} for user ${userString} with:\n Input: ${cleanInput}\n Error: ` + JSON.stringify(error),
{
functionName,
error,
params,
user: userString
}
);
reject(error);
} catch (e) {
reject(e);