How to see logs of handler #26
-
I have been thinking and tried to use code below but I have met with problem described below Codeasync ({ require, deep, data: { newLink: linkGetActiveContributors } }) => {
const PACKAGE_NAME = "@freephoenix888/get-active-contributors"
const logs: Array<any> = []
try {
const log = getLoggerWithNameSpace(PACKAGE_NAME);
log("Starting...!");
throw new Error("There is an error:)")
} catch (error) {
// console.log(logs.join('\n')) // no-no. We want logs to be in deep. Not in docker-logs :angry:;
throw error;
}
function getLoggerWithNameSpace(namespace: string) {
return function (message: any) {
logs.push(`${namespace}: ${message}`);
}
}
} How should we let our users to see logs? If there is no error we can return object like this:
But what should we do on error? |
Beta Was this translation helpful? Give feedback.
Answered by
FreePhoenix888
Jul 7, 2023
Replies: 1 comment
-
On errorthrow {
logs,
errors: [error]
} On successreturn {
logs,
result
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
FreePhoenix888
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
On error
On success