Switching to logger.
This commit is contained in:
parent
68db552e37
commit
89afc5e169
|
@ -120,7 +120,7 @@ async function fetchPhoto(photoUrl, index, label, attempt = 1) {
|
|||
|
||||
throw new Error(`Response ${res.statusCode} not OK`);
|
||||
} catch (error) {
|
||||
console.warn(`Failed attempt ${attempt}/3 to fetch photo ${index + 1} for ${label} (${photoUrl}): ${error}`);
|
||||
logger.warn(`Failed attempt ${attempt}/3 to fetch photo ${index + 1} for ${label} (${photoUrl}): ${error}`);
|
||||
|
||||
if (attempt < 3) {
|
||||
await Promise.delay(1000);
|
||||
|
@ -171,7 +171,7 @@ async function storePhotos(photos, {
|
|||
primaryRole, // role to assign to first photo if not already in database, used mainly for avatars
|
||||
}, label) {
|
||||
if (!photos || photos.length === 0) {
|
||||
console.warn(`No ${role}s available for ${label}`);
|
||||
logger.info(`No ${role}s available for ${label}`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -273,7 +273,7 @@ async function storeTrailer(trailers, {
|
|||
: trailers;
|
||||
|
||||
if (!trailer || !trailer.src) {
|
||||
console.warn(`No trailer available for ${label}`);
|
||||
logger.info(`No trailer available for ${label}`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
const config = require('config');
|
||||
|
||||
const logger = require('./logger');
|
||||
const argv = require('./argv');
|
||||
const knex = require('./knex');
|
||||
const whereOr = require('./utils/where-or');
|
||||
|
@ -102,7 +103,7 @@ async function fetchSitesFromArgv() {
|
|||
.leftJoin('networks', 'sites.network_id', 'networks.id');
|
||||
|
||||
const curatedSites = await curateSites(rawSites, true);
|
||||
console.log(`Found ${curatedSites.length} sites in database`);
|
||||
logger.info(`Found ${curatedSites.length} sites in database`);
|
||||
|
||||
return sitesByNetwork(curatedSites);
|
||||
}
|
||||
|
@ -120,7 +121,7 @@ async function fetchSitesFromConfig() {
|
|||
.leftJoin('networks', 'sites.network_id', 'networks.id');
|
||||
|
||||
const curatedSites = await curateSites(rawSites, true);
|
||||
console.log(`Found ${curatedSites.length} sites in database`);
|
||||
logger.info(`Found ${curatedSites.length} sites in database`);
|
||||
|
||||
return sitesByNetwork(curatedSites);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue