Change console statements to debug or warn

This commit is contained in:
2026-01-27 12:58:36 +07:00
parent 8c58a76030
commit 0212fa359b
8 changed files with 19 additions and 22 deletions

View File

@@ -722,7 +722,7 @@ export default class MapComponent extends Component {
if (this.args.isSidebarOpen) { if (this.args.isSidebarOpen) {
// If it's a bookmark, we allow "switching" to it even if sidebar is open // If it's a bookmark, we allow "switching" to it even if sidebar is open
if (clickedBookmark) { if (clickedBookmark) {
console.log( console.debug(
'Clicked bookmark while sidebar open (switching):', 'Clicked bookmark while sidebar open (switching):',
clickedBookmark clickedBookmark
); );
@@ -739,7 +739,7 @@ export default class MapComponent extends Component {
// Normal behavior (sidebar is closed) // Normal behavior (sidebar is closed)
if (clickedBookmark) { if (clickedBookmark) {
console.log('Clicked bookmark:', clickedBookmark); console.debug('Clicked bookmark:', clickedBookmark);
this.router.transitionTo('place', clickedBookmark); this.router.transitionTo('place', clickedBookmark);
return; return;
} }

View File

@@ -50,7 +50,7 @@ export default class PlacesSidebar extends Component {
if (confirm(`Delete "${place.title}"?`)) { if (confirm(`Delete "${place.title}"?`)) {
try { try {
await this.storage.removePlace(place); await this.storage.removePlace(place);
console.log('Place deleted:', place.title); console.debug('Place deleted:', place.title);
// Notify parent to refresh map bookmarks // Notify parent to refresh map bookmarks
if (this.args.onBookmarkChange) { if (this.args.onBookmarkChange) {
@@ -104,7 +104,7 @@ export default class PlacesSidebar extends Component {
try { try {
const savedPlace = await this.storage.storePlace(placeData); const savedPlace = await this.storage.storePlace(placeData);
console.log('Place saved:', placeData.title); console.debug('Place saved:', placeData.title);
// Notify parent to refresh map bookmarks // Notify parent to refresh map bookmarks
if (this.args.onBookmarkChange) { if (this.args.onBookmarkChange) {
@@ -131,7 +131,7 @@ export default class PlacesSidebar extends Component {
async updateBookmark(updatedPlace) { async updateBookmark(updatedPlace) {
try { try {
const savedPlace = await this.storage.updatePlace(updatedPlace); const savedPlace = await this.storage.updatePlace(updatedPlace);
console.log('Place updated:', savedPlace.title); console.debug('Place updated:', savedPlace.title);
// Notify parent to refresh map/lists // Notify parent to refresh map/lists
if (this.args.onBookmarkChange) { if (this.args.onBookmarkChange) {

View File

@@ -11,7 +11,7 @@ export default class PlaceRoute extends Route {
if (id.startsWith('osm:node:') || id.startsWith('osm:way:')) { if (id.startsWith('osm:node:') || id.startsWith('osm:way:')) {
const [, type, osmId] = id.split(':'); const [, type, osmId] = id.split(':');
console.log(`Fetching explicit OSM ${type}:`, osmId); console.debug(`Fetching explicit OSM ${type}:`, osmId);
return this.loadOsmPlace(osmId, type); return this.loadOsmPlace(osmId, type);
} }
@@ -20,7 +20,7 @@ export default class PlaceRoute extends Route {
let bookmark = this.storage.findPlaceById(id); let bookmark = this.storage.findPlaceById(id);
if (bookmark) { if (bookmark) {
console.log('Found in bookmarks:', bookmark.title); console.debug('Found in bookmarks:', bookmark.title);
return bookmark; return bookmark;
} }
@@ -31,7 +31,7 @@ export default class PlaceRoute extends Route {
async waitForSync() { async waitForSync() {
if (this.storage.initialSyncDone) return; if (this.storage.initialSyncDone) return;
console.log('Waiting for initial storage sync...'); console.debug('Waiting for initial storage sync...');
const timeout = 5000; const timeout = 5000;
const start = Date.now(); const start = Date.now();

View File

@@ -12,7 +12,7 @@ export default class OsmService extends Service {
// Return cached results if the query is identical to the last one // Return cached results if the query is identical to the last one
if (this.lastQueryKey === queryKey && this.cachedResults) { if (this.lastQueryKey === queryKey && this.cachedResults) {
console.log('Returning cached Overpass results for:', queryKey); console.debug('Returning cached Overpass results for:', queryKey);
return this.cachedResults; return this.cachedResults;
} }
@@ -52,7 +52,7 @@ out center;
return results; return results;
} catch (e) { } catch (e) {
if (e.name === 'AbortError') { if (e.name === 'AbortError') {
console.log('Overpass request aborted'); console.debug('Overpass request aborted');
return []; return [];
} }
throw e; throw e;
@@ -78,7 +78,7 @@ out center;
const res = await fetch(url, options); const res = await fetch(url, options);
if (!res.ok && retries > 0 && [502, 503, 504, 429].includes(res.status)) { if (!res.ok && retries > 0 && [502, 503, 504, 429].includes(res.status)) {
console.log( console.warn(
`Overpass request failed with ${res.status}. Retrying... (${retries} left)` `Overpass request failed with ${res.status}. Retrying... (${retries} left)`
); );
await new Promise((r) => setTimeout(r, 1000)); await new Promise((r) => setTimeout(r, 1000));
@@ -88,7 +88,7 @@ out center;
return res; return res;
} catch (e) { } catch (e) {
if (retries > 0 && e.name !== 'AbortError') { if (retries > 0 && e.name !== 'AbortError') {
console.log(`Retrying Overpass request... (${retries} left)`); console.debug(`Retrying Overpass request... (${retries} left)`);
await new Promise((r) => setTimeout(r, 1000)); await new Promise((r) => setTimeout(r, 1000));
return this.fetchWithRetry(url, options, retries - 1); return this.fetchWithRetry(url, options, retries - 1);
} }

View File

@@ -23,7 +23,6 @@ export default class StorageService extends Service {
constructor() { constructor() {
super(...arguments); super(...arguments);
console.log('ohai');
this.rs = new RemoteStorage({ this.rs = new RemoteStorage({
modules: [Places], modules: [Places],
@@ -45,13 +44,11 @@ export default class StorageService extends Service {
}); });
this.rs.on('connected', () => { this.rs.on('connected', () => {
console.debug('Remote storage connected');
this.connected = true; this.connected = true;
this.userAddress = this.rs.remote.userAddress; this.userAddress = this.rs.remote.userAddress;
}); });
this.rs.on('disconnected', () => { this.rs.on('disconnected', () => {
console.debug('Remote storage disconnected');
this.connected = false; this.connected = false;
this.userAddress = null; this.userAddress = null;
this.placesInView = []; this.placesInView = [];
@@ -128,7 +125,7 @@ export default class StorageService extends Service {
// Recalculate prefixes for the current view // Recalculate prefixes for the current view
const required = getGeohashPrefixesInBbox(this.currentBbox); const required = getGeohashPrefixesInBbox(this.currentBbox);
console.log('Reloading view due to changes, prefixes:', required); console.debug('Reloading view due to changes, prefixes:', required);
// Force load these prefixes (bypassing the 'already loaded' check in loadPlacesInBounds) // Force load these prefixes (bypassing the 'already loaded' check in loadPlacesInBounds)
this.loadAllPlaces(required); this.loadAllPlaces(required);
@@ -144,11 +141,11 @@ export default class StorageService extends Service {
); );
if (missingPrefixes.length === 0) { if (missingPrefixes.length === 0) {
// console.log('All prefixes already loaded for this view'); // console.debug('All prefixes already loaded for this view');
return; return;
} }
console.log('Loading new prefixes:', missingPrefixes); console.debug('Loading new prefixes:', missingPrefixes);
// 3. Load places for only the new prefixes // 3. Load places for only the new prefixes
await this.loadAllPlaces(missingPrefixes); await this.loadAllPlaces(missingPrefixes);
@@ -195,7 +192,7 @@ export default class StorageService extends Service {
} else { } else {
if (!prefixes) this.placesInView = []; if (!prefixes) this.placesInView = [];
} }
console.log('Loaded saved places:', this.placesInView.length); console.debug('Loaded saved places:', this.placesInView.length);
} catch (e) { } catch (e) {
console.error('Failed to load places:', e); console.error('Failed to load places:', e);
} }

View File

@@ -28,7 +28,7 @@ export default class ApplicationComponent extends Component {
constructor() { constructor() {
super(...arguments); super(...arguments);
console.log('Application component constructed'); console.debug('Application component constructed');
// Access the service to ensure it is instantiated // Access the service to ensure it is instantiated
this.storage; this.storage;
} }

View File

@@ -63,7 +63,7 @@ export default class PlaceTemplate extends Component {
@action @action
handleUpdate(newPlace) { handleUpdate(newPlace) {
console.log('Updating local place state:', newPlace); console.debug('Updating local place state:', newPlace);
this.localPlace = newPlace; this.localPlace = newPlace;
this.storage.notifyChange(); this.storage.notifyChange();
} }

View File

@@ -45,7 +45,7 @@ export default class PlaceNewTemplate extends Component {
}; };
const savedPlace = await this.storage.storePlace(placeData); const savedPlace = await this.storage.storePlace(placeData);
console.log('Created private place:', savedPlace.title); console.debug('Created private place:', savedPlace.title);
// Transition to the new place // Transition to the new place
this.router.replaceWith('place', savedPlace); this.router.replaceWith('place', savedPlace);