From 82c053f582c70dbc54fe3def21e3e8a98ff68687 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Zbytovsk=C3=BD?= Date: Tue, 16 Apr 2024 13:44:10 +0200 Subject: [PATCH] tagging: disable debug logs (#306) --- src/config.ts | 2 ++ src/services/tagging/idTaggingScheme.ts | 3 ++- src/services/tagging/presets.ts | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/config.ts b/src/config.ts index 00fe67f29..45d252f90 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,3 +1,5 @@ export const SHOW_PROTOTYPE_UI = false; export const DEFAULT_MAP = 'basic'; + +export const DEBUG_ID_SCHEMA = false; diff --git a/src/services/tagging/idTaggingScheme.ts b/src/services/tagging/idTaggingScheme.ts index 4f311468d..dd8227ce0 100644 --- a/src/services/tagging/idTaggingScheme.ts +++ b/src/services/tagging/idTaggingScheme.ts @@ -7,9 +7,10 @@ import { Preset, UiField } from './types/Presets'; import { publishDbgObject } from '../../utils'; import { getShortId } from '../helpers'; import { Field } from './types/Fields'; +import { DEBUG_ID_SCHEMA } from '../../config'; const logMoreMatchingFields = (matchingFields: Field[], key: string) => { - if (matchingFields.length > 1) { + if (DEBUG_ID_SCHEMA && matchingFields.length > 1) { // eslint-disable-next-line no-console console.debug( `More fields matching key ${key}: ${matchingFields.map( diff --git a/src/services/tagging/presets.ts b/src/services/tagging/presets.ts index b6b446a27..b77e1d9c1 100644 --- a/src/services/tagging/presets.ts +++ b/src/services/tagging/presets.ts @@ -1,6 +1,7 @@ import { presets } from './data'; import { Feature } from '../types'; import { Preset } from './types/Presets'; +import { DEBUG_ID_SCHEMA } from '../../config'; // taken from iD codebase https://github.com/openstreetmap/iD/blob/dd30a39d7487e1084396712ce861f4b6c5a07849/modules/presets/preset.js#L61 // added code for addr:* matching @@ -99,7 +100,7 @@ export const getPresetForFeature = (feature: Feature): Preset => { const winner = sortedByScore[0]; const winners = sortedByScore.filter((c) => c.score === winner.score); - if (winners.length > 1) { + if (DEBUG_ID_SCHEMA && winners.length > 1) { // eslint-disable-next-line no-console console.debug('This feature matches more presets by same score:', winners); }