Skip to content

Commit e4c836c

Browse files
authored
Merge pull request #115 from MrAlders0n/copilot/update-debug-logging-guidelines-yet-again
Fix Session Log: Add dB units to SNR values and restore CSS styling
2 parents 32f6455 + 7479736 commit e4c836c

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

content/wardrive.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1817,7 +1817,7 @@ function createChipElement(type, value) {
18171817

18181818
const snrSpan = document.createElement('span');
18191819
snrSpan.className = 'chipSnr';
1820-
snrSpan.textContent = value.toFixed(2);
1820+
snrSpan.textContent = `${value.toFixed(2)} dB`;
18211821

18221822
chip.appendChild(idSpan);
18231823
chip.appendChild(snrSpan);
@@ -1831,6 +1831,7 @@ function createChipElement(type, value) {
18311831
* @returns {HTMLElement} Log entry element
18321832
*/
18331833
function createLogEntryElement(entry) {
1834+
debugLog(`Creating log entry element for timestamp: ${entry.timestamp}`);
18341835
const logEntry = document.createElement('div');
18351836
logEntry.className = 'logEntry';
18361837

@@ -1860,16 +1861,20 @@ function createLogEntryElement(entry) {
18601861
noneSpan.className = 'text-xs text-slate-500 italic';
18611862
noneSpan.textContent = 'No repeats heard';
18621863
chipsRow.appendChild(noneSpan);
1864+
debugLog(`Log entry has no events (no repeats heard)`);
18631865
} else {
1866+
debugLog(`Log entry has ${entry.events.length} event(s)`);
18641867
entry.events.forEach(event => {
18651868
const chip = createChipElement(event.type, event.value);
18661869
chipsRow.appendChild(chip);
1870+
debugLog(`Added chip for repeater ${event.type} with SNR ${event.value} dB`);
18671871
});
18681872
}
18691873

18701874
logEntry.appendChild(topRow);
18711875
logEntry.appendChild(chipsRow);
18721876

1877+
debugLog(`Log entry element created successfully with class: ${logEntry.className}`);
18731878
return logEntry;
18741879
}
18751880

@@ -1895,7 +1900,7 @@ function updateLogSummary() {
18951900
// Show SNR from first event if available
18961901
if (lastEntry.events.length > 0) {
18971902
const firstEvent = lastEntry.events[0];
1898-
logLastSnr.textContent = `${firstEvent.type} ${firstEvent.value.toFixed(1)}`;
1903+
logLastSnr.textContent = `${firstEvent.type} ${firstEvent.value.toFixed(1)} dB`;
18991904
logLastSnr.className = `text-xs font-mono ${getSnrSeverityClass(firstEvent.value).replace('snr-', 'text-')}`;
19001905
} else {
19011906
logLastSnr.textContent = 'None';
@@ -1909,6 +1914,7 @@ function updateLogSummary() {
19091914
function renderLogEntries() {
19101915
if (!sessionPingsEl) return;
19111916

1917+
debugLog(`Rendering ${sessionLogState.entries.length} log entries`);
19121918
sessionPingsEl.innerHTML = '';
19131919

19141920
if (sessionLogState.entries.length === 0) {
@@ -1917,21 +1923,26 @@ function renderLogEntries() {
19171923
placeholder.className = 'text-xs text-slate-500 italic text-center py-4';
19181924
placeholder.textContent = 'No pings logged yet';
19191925
sessionPingsEl.appendChild(placeholder);
1926+
debugLog(`Rendered placeholder (no entries)`);
19201927
return;
19211928
}
19221929

19231930
// Render newest first
19241931
const entries = [...sessionLogState.entries].reverse();
19251932

1926-
entries.forEach(entry => {
1933+
entries.forEach((entry, index) => {
19271934
const element = createLogEntryElement(entry);
19281935
sessionPingsEl.appendChild(element);
1936+
debugLog(`Appended log entry ${index + 1}/${entries.length} to sessionPingsEl`);
19291937
});
19301938

19311939
// Auto-scroll to top (newest)
19321940
if (sessionLogState.autoScroll && logScrollContainer) {
19331941
logScrollContainer.scrollTop = 0;
1942+
debugLog(`Auto-scrolled to top of log container`);
19341943
}
1944+
1945+
debugLog(`Finished rendering all log entries`);
19351946
}
19361947

19371948
/**

index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<link rel="manifest" href="content/wardrive.json">
1313
<link rel="icon" href="content/wardrive.png">
1414
<link rel="stylesheet" href="content/tailwind.css">
15+
<link rel="stylesheet" href="content/style.css">
1516

1617
<!-- Leaflet -->
1718
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"

0 commit comments

Comments
 (0)