Skip to content

Commit 313814e

Browse files
author
sidey79
committed
fix: logging: suppress debug output when log-level is INFO
Die Debug-Meldungen in den Protokolldateien wurden fälschlicherweise über print() ausgegeben, was dazu führte, dass sie unabhängig vom konfigurierten log-level (z.B. INFO) im Terminal erschienen. Die direkten print()-Aufrufe wurden durch korrekte logging.debug()-Aufrufe in sd_protocols/message_synced.py und sd_protocols/pattern_utils.py ersetzt.
1 parent 9098fb9 commit 313814e

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

sd_protocols/message_synced.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def demodulate_ms(self, msg_data: Dict[str, Any], msg_type: str = "MS") -> List[
7171
for pidx, pval in patterns.items():
7272
norm_patterns[pidx] = round(pval / clock_abs, 1)
7373

74-
print(f"DEBUG: Patterns: {patterns}, Clock: {clock_abs}, Norm: {norm_patterns}")
74+
logging.debug(f"Patterns: {patterns}, Clock: {clock_abs}, Norm: {norm_patterns}")
7575

7676
decoded_messages = []
7777

@@ -84,7 +84,7 @@ def demodulate_ms(self, msg_data: Dict[str, Any], msg_type: str = "MS") -> List[
8484
if proto_clock > 0:
8585
# Perl: SIGNALduino_inTol(prop_clock, clockabs, clockabs*0.30)
8686
if abs(proto_clock - clock_abs) > (clock_abs * 0.3):
87-
print(f"DEBUG: Protocol {pid} clock mismatch: {proto_clock} vs {clock_abs}")
87+
logging.debug(f"Protocol {pid} clock mismatch: {proto_clock} vs {clock_abs}")
8888
continue
8989

9090
# Check Patterns
@@ -127,7 +127,7 @@ def demodulate_ms(self, msg_data: Dict[str, Any], msg_type: str = "MS") -> List[
127127

128128
pstr = pattern_exists(search_pattern, norm_patterns, raw_data)
129129

130-
print(f"DEBUG: Protocol {pid} Key {key} Pattern {search_pattern} Result {pstr}")
130+
logging.debug(f"Protocol {pid} Key {key} Pattern {search_pattern} Result {pstr}")
131131

132132
if pstr != -1:
133133
pattern_lookup[pstr] = representation

sd_protocols/pattern_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
Ports logic from SIGNALduino_PatternExists and related Perl functions.
44
"""
55
from __future__ import annotations
6+
import logging
67
import math
78
import itertools
89
from typing import Dict, List, Any, Optional, Tuple, Union
@@ -96,7 +97,7 @@ def pattern_exists(search_pattern: List[float], pattern_list: Dict[str, float],
9697
if total_combinations > 10000:
9798
if debug_callback:
9899
debug_callback(f"Too many combinations: {total_combinations}. Aborting pattern match.")
99-
print(f"DEBUG: Too many combinations: {total_combinations} for {search_pattern}")
100+
logging.debug(f"Too many combinations: {total_combinations} for {search_pattern}")
100101
return -1
101102

102103
product = cartesian_product(candidates_list)

0 commit comments

Comments
 (0)