Skip to content

Commit

Permalink
[UI] Better logging in UI server (#3197)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobgy authored Mar 3, 2020
1 parent 941f4f5 commit fc13417
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
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;
}
}

0 comments on commit fc13417

Please sign in to comment.