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

[UI] Better logging in UI server #3197

Merged
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
5 changes: 4 additions & 1 deletion frontend/server/handlers/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,10 @@ function getGCSArtifactHandler(options: { key: string; bucket: string }) {
res.send();
return;
}
console.log(`Found ${matchingFiles.length} matching files:`, matchingFiles);
console.log(
`Found ${matchingFiles.length} matching files: `,
matchingFiles.map(file => file.name).join(','),
);
let contents = '';
matchingFiles.forEach((f, i) => {
const buffer: Buffer[] = [];
Expand Down
9 changes: 8 additions & 1 deletion frontend/server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,12 @@
import { UIServer } from './app';
import { loadConfigs } from './configs';

const app = new UIServer(loadConfigs(process.argv, process.env));
const configs = loadConfigs(process.argv, process.env);
if (process.env.NODE_ENV !== 'test') {
console.log({
...configs,
artifacts: 'Artifacts config contains credentials, so it is omitted',
});
}
const app = new UIServer(configs);
app.start();
2 changes: 2 additions & 0 deletions frontend/server/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ export function loadJSON<T>(filepath?: string, defaultValue?: T): T | undefined
try {
return JSON.parse(readFileSync(filepath, 'utf-8'));
} catch (error) {
console.error(`Failed reading json data from '${filepath}':`);
console.error(error);
return defaultValue;
}
}