using winston logger

This commit is contained in:
orangecoding
2025-09-13 18:57:56 +02:00
parent e868cdce86
commit 21415dcff3
19 changed files with 230 additions and 49 deletions

View File

@@ -3,6 +3,7 @@ import { setKnownListings, getKnownListings } from './services/storage/listingsS
import * as notify from './notification/notify.js';
import Extractor from './services/extractor/extractor.js';
import urlModifier from './services/queryStringMutator.js';
import logger from './services/logger.js';
class FredyRuntime {
/**
@@ -59,7 +60,7 @@ class FredyRuntime {
})
.catch((err) => {
reject(err);
console.error(err);
logger.error(err);
});
});
}
@@ -104,9 +105,7 @@ class FredyRuntime {
const filteredList = listings.filter((listing) => {
const similar = this._similarityCache.hasSimilarEntries(listing.title, listing.address);
if (similar) {
/* eslint-disable no-console */
console.debug(`Filtering similar entry for title: ${listing.title} and address ${listing.address}`);
/* eslint-enable no-console */
logger.debug(`Filtering similar entry for title: ${listing.title} and address ${listing.address}`);
}
return !similar;
});
@@ -115,7 +114,7 @@ class FredyRuntime {
}
_handleError(err) {
if (err.name !== 'NoNewListingsWarning') console.error(err);
if (err.name !== 'NoNewListingsWarning') logger.error(err);
}
}