-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: refactor startup #37
Conversation
…ar/refactor-startup Signed-off-by: tcar <[email protected]>
Signed-off-by: tcar <[email protected]>
…ar/refactor-startup Signed-off-by: tcar <[email protected]>
Signed-off-by: tcar <[email protected]>
src/utils/logger.ts
Outdated
), | ||
}), | ||
]; | ||
export function getLogger(domainID?: string): winston.Logger { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to still have the singleton logger and then if you need a label create:
export function createChildLogger(labels: Record<string, any/string>): winston.Logger {
return logger.child({
labels: {
...logger.defaultMeta.labels,
label: label
}
});
}
This way if you go deeper in the stack and add more labels you just create a child of the one that already has the labels.
Also, you don't have to call getLogger() everywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually i think we don't need createChildLogger. We can just do logger.child({additionalOptions})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense.
src/main.ts
Outdated
envVars.domainMetadata.rpcUrl, | ||
); | ||
break; | ||
for (const domain of sharedConfig.domains) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to have a separate env variable that defines which domains you want.
ENV_DOMAINS
for example and then you can specify which to index.
So if we want to skip some domain or separate them by containers we can easily do it just by changing the config slightly.
Signed-off-by: tcar <[email protected]>
Signed-off-by: tcar <[email protected]>
Signed-off-by: tcar <[email protected]>
…ar/refactor-startup Signed-off-by: tcar <[email protected]>
Signed-off-by: tcar <[email protected]>
Signed-off-by: tcar <[email protected]>
Signed-off-by: tcar <[email protected]>
Description