Skip to content

Commit e9acc30

Browse files
BobgyJeffwan
authored andcommitted
[UI] Better logging in UI server (kubeflow#3197)
1 parent 83bf2ae commit e9acc30

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

frontend/server/handlers/artifacts.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,10 @@ function getGCSArtifactHandler(options: { key: string; bucket: string }) {
192192
res.send();
193193
return;
194194
}
195-
console.log(`Found ${matchingFiles.length} matching files:`, matchingFiles);
195+
console.log(
196+
`Found ${matchingFiles.length} matching files: `,
197+
matchingFiles.map(file => file.name).join(','),
198+
);
196199
let contents = '';
197200
matchingFiles.forEach((f, i) => {
198201
const buffer: Buffer[] = [];

frontend/server/server.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,12 @@
1414
import { UIServer } from './app';
1515
import { loadConfigs } from './configs';
1616

17-
const app = new UIServer(loadConfigs(process.argv, process.env));
17+
const configs = loadConfigs(process.argv, process.env);
18+
if (process.env.NODE_ENV !== 'test') {
19+
console.log({
20+
...configs,
21+
artifacts: 'Artifacts config contains credentials, so it is omitted',
22+
});
23+
}
24+
const app = new UIServer(configs);
1825
app.start();

frontend/server/utils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ export function loadJSON<T>(filepath?: string, defaultValue?: T): T | undefined
5858
try {
5959
return JSON.parse(readFileSync(filepath, 'utf-8'));
6060
} catch (error) {
61+
console.error(`Failed reading json data from '${filepath}':`);
62+
console.error(error);
6163
return defaultValue;
6264
}
6365
}

0 commit comments

Comments
 (0)