Skip to content

Commit

Permalink
tagging: disable debug logs (#306)
Browse files Browse the repository at this point in the history
  • Loading branch information
zbycz authored Apr 16, 2024
1 parent 9839324 commit 82c053f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export const SHOW_PROTOTYPE_UI = false;

export const DEFAULT_MAP = 'basic';

export const DEBUG_ID_SCHEMA = false;
3 changes: 2 additions & 1 deletion src/services/tagging/idTaggingScheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
3 changes: 2 additions & 1 deletion src/services/tagging/presets.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 82c053f

Please sign in to comment.