Skip to content
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

Improve debug logs #974

Merged
merged 3 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/common/util/debug-logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const logMessagesKeys: (keyof typeof STRINGS)[] = [
'INITIALIZING_PLUGIN',
'LOADING_PLUGIN_FROM_PATH',
'COMPUTING_PIPELINE_FOR_NODE',
'COMPUTING_COMPONENT_PIPELINE',
'REGROUPING',
'OBSERVING',
'MERGING_DEFAULTS_WITH_INPUT_DATA',
Expand Down Expand Up @@ -110,9 +111,12 @@ const debugLog = (level: LogLevel, args: any[], debugMode: boolean) => {

const date = new Date().toISOString();
const plugin = pluginNameManager.currentPluginName;
const formattedMessage = `${level}: ${date}: ${
plugin ? plugin + ': ' : ''
}${args.join(', ')}`;
const isExeption = args[0].includes('**Computing');
const message = `${level}: ${date}: ${plugin ? plugin + ': ' : ''}${args.join(
', '
)}`;

const formattedMessage = isExeption ? args.join(', ') : message;

if (debugMode) {
switch (level) {
Expand Down
2 changes: 2 additions & 0 deletions src/if-run/config/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ Note that for the '--output' option you also need to define the output type in y
`Loading ${pluginName} from ${path}`,
COMPUTING_PIPELINE_FOR_NODE: (nodeName: string) =>
`Running compute pipeline: \`${nodeName}\` plugin`,
COMPUTING_COMPONENT_PIPELINE: (component: string) =>
`**Computing \`${component}\` pipeline**`,
REGROUPING: 'Regrouping',
OBSERVING: (nodeName: string) =>
`Running observe pipeline: \`${nodeName}\` plugin`,
Expand Down
2 changes: 2 additions & 0 deletions src/if-run/lib/compute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const {
EMPTY_PIPELINE,
CONFIG_WARN,
COMPUTING_PIPELINE_FOR_NODE,
COMPUTING_COMPONENT_PIPELINE,
REGROUPING,
OBSERVING,
} = STRINGS;
Expand All @@ -27,6 +28,7 @@ const {
*/
const traverse = async (children: any, params: ComputeParams) => {
for (const child in children) {
console.debug(COMPUTING_COMPONENT_PIPELINE(child));
await computeNode(children[child], params);
}
};
Expand Down