2019-07-09 23:38:32 +00:00
|
|
|
const { getZone, getLog } = require('./utils/cloudflare.js');
|
2017-05-25 05:23:53 +00:00
|
|
|
|
2019-07-09 23:38:32 +00:00
|
|
|
async function run(rayId) {
|
|
|
|
if (rayId == null) {
|
|
|
|
console.error('Missing the RAY_ID argument; use `node show-log.js RAY_ID`');
|
|
|
|
return 1;
|
|
|
|
}
|
2017-05-25 05:23:53 +00:00
|
|
|
|
2019-07-09 23:38:32 +00:00
|
|
|
const zone = await getZone('unpkg.com');
|
|
|
|
const entry = await getLog(zone.id, rayId);
|
|
|
|
|
|
|
|
console.log(entry || 'NOT FOUND');
|
|
|
|
return 0;
|
2017-11-08 19:07:48 +00:00
|
|
|
}
|
2017-05-25 05:23:53 +00:00
|
|
|
|
2019-07-09 23:38:32 +00:00
|
|
|
const rayId = process.argv[2];
|
|
|
|
|
|
|
|
run(rayId).then(exitCode => {
|
|
|
|
process.exit(exitCode);
|
2018-02-18 02:00:56 +00:00
|
|
|
});
|