Remove debug console logs from geolocation detection

This commit is contained in:
Volodymyr Kravchenko 2025-02-06 00:42:08 +02:00
parent c6373adcb1
commit 26258b37a3

View file

@ -19,7 +19,6 @@ let lookupPromise: any = null;
// This function returns the open DB. If it's already opening/open, just return the existing promise. // This function returns the open DB. If it's already opening/open, just return the existing promise.
export function getLookup() { export function getLookup() {
if (!lookupPromise) { if (!lookupPromise) {
console.log('debug: loading GeoLite2-City.mmdb');
const dir = path.join(process.cwd(), 'geo'); const dir = path.join(process.cwd(), 'geo');
lookupPromise = maxmind.open(path.resolve(dir, 'GeoLite2-City.mmdb')); lookupPromise = maxmind.open(path.resolve(dir, 'GeoLite2-City.mmdb'));
} }
@ -121,8 +120,6 @@ export async function getLocation(ip: string, req: NextApiRequestCollect) {
const lookup = await getLookup(); const lookup = await getLookup();
const result = lookup.get(ip); const result = lookup.get(ip);
console.log('debug_result:', result);
if (result) { if (result) {
const country = result.country?.iso_code ?? result?.registered_country?.iso_code; const country = result.country?.iso_code ?? result?.registered_country?.iso_code;
const subdivision1 = result.subdivisions?.[0]?.iso_code; const subdivision1 = result.subdivisions?.[0]?.iso_code;