Change console statements to debug or warn

This commit is contained in:
Râu Cao 2026-01-27 12:58:36 +07:00
parent 8c58a76030
commit 0212fa359b
Signed by: raucao
GPG Key ID: 37036C356E56CC51
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 it's a bookmark, we allow "switching" to it even if sidebar is open
if (clickedBookmark) {
console.log(
console.debug(
'Clicked bookmark while sidebar open (switching):',
clickedBookmark
);
@ -739,7 +739,7 @@ export default class MapComponent extends Component {
// Normal behavior (sidebar is closed)
if (clickedBookmark) {
console.log('Clicked bookmark:', clickedBookmark);
console.debug('Clicked bookmark:', clickedBookmark);
this.router.transitionTo('place', clickedBookmark);
return;
}

View File

@ -50,7 +50,7 @@ export default class PlacesSidebar extends Component {
if (confirm(`Delete "${place.title}"?`)) {
try {
await this.storage.removePlace(place);
console.log('Place deleted:', place.title);
console.debug('Place deleted:', place.title);
// Notify parent to refresh map bookmarks
if (this.args.onBookmarkChange) {
@ -104,7 +104,7 @@ export default class PlacesSidebar extends Component {
try {
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
if (this.args.onBookmarkChange) {
@ -131,7 +131,7 @@ export default class PlacesSidebar extends Component {
async updateBookmark(updatedPlace) {
try {
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
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:')) {
const [, type, osmId] = id.split(':');
console.log(`Fetching explicit OSM ${type}:`, osmId);
console.debug(`Fetching explicit OSM ${type}:`, osmId);
return this.loadOsmPlace(osmId, type);
}
@ -20,7 +20,7 @@ export default class PlaceRoute extends Route {
let bookmark = this.storage.findPlaceById(id);
if (bookmark) {
console.log('Found in bookmarks:', bookmark.title);
console.debug('Found in bookmarks:', bookmark.title);
return bookmark;
}
@ -31,7 +31,7 @@ export default class PlaceRoute extends Route {
async waitForSync() {
if (this.storage.initialSyncDone) return;
console.log('Waiting for initial storage sync...');
console.debug('Waiting for initial storage sync...');
const timeout = 5000;
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
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;
}
@ -52,7 +52,7 @@ out center;
return results;
} catch (e) {
if (e.name === 'AbortError') {
console.log('Overpass request aborted');
console.debug('Overpass request aborted');
return [];
}
throw e;
@ -78,7 +78,7 @@ out center;
const res = await fetch(url, options);
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)`
);
await new Promise((r) => setTimeout(r, 1000));
@ -88,7 +88,7 @@ out center;
return res;
} catch (e) {
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));
return this.fetchWithRetry(url, options, retries - 1);
}

View File

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

View File

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

View File

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

View File

@ -45,7 +45,7 @@ export default class PlaceNewTemplate extends Component {
};
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
this.router.replaceWith('place', savedPlace);