fix: harden application log viewer
Add an Application Logs window backed by a bounded persistent main log file. The viewer loads history from lanspread.log, subscribes to live INFO/WARN/ERROR log events, supports filtering/copy/pause controls, and keeps the menu/window routing separate from the unpack log viewer. The backend sink now owns serialized access to the log file. History reads and append-time trimming use the same sink lock, so opening the logs window cannot race with a concurrent write and rewrite away a freshly appended line. The sink also keeps a persistent file handle instead of reopening the file for each captured event. Live log events carry sink-local sequence ids. The frontend uses the history watermark plus returned history line counts to suppress live events that were already included in the history response, while preserving buffered rows that were trimmed out of the history file. Auto-scroll now follows the last visible row identity, so it continues following after the in-memory cap keeps the row count stable. No timestamp code change was needed. On the Linux dev host, a temporary probe showed time::OffsetDateTime::now_local() returning +02:00 while UTC was +00:00, matching the host CEST offset. Test Plan: - just fmt - just frontend-test - just test - just clippy - just build - git diff --cached --check - temporary Linux probe of OffsetDateTime::now_local() showed local +02:00 Refs: none
This commit is contained in:
@@ -1,11 +1,16 @@
|
||||
import { MainWindow } from './windows/MainWindow';
|
||||
import { MainLogsWindow, isMainLogsView } from './MainLogsWindow';
|
||||
import { UnpackLogsWindow, isUnpackLogsView } from './UnpackLogsWindow';
|
||||
|
||||
/**
|
||||
* Tauri can spawn this bundle in either the main launcher window or the
|
||||
* unpack-logs companion window. The URL query string disambiguates the two so
|
||||
* companion log windows. The URL query string disambiguates the views so
|
||||
* a single Vite build serves both.
|
||||
*/
|
||||
const App = () => (isUnpackLogsView() ? <UnpackLogsWindow /> : <MainWindow />);
|
||||
const App = () => {
|
||||
if (isMainLogsView()) return <MainLogsWindow />;
|
||||
if (isUnpackLogsView()) return <UnpackLogsWindow />;
|
||||
return <MainWindow />;
|
||||
};
|
||||
|
||||
export default App;
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
.main-log-window {
|
||||
height: 100vh;
|
||||
box-sizing: border-box;
|
||||
padding: 18px;
|
||||
background: #000313;
|
||||
color: #D5DBFE;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.main-log-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.main-log-header h1 {
|
||||
margin: 0;
|
||||
font-size: 22px;
|
||||
}
|
||||
|
||||
.main-log-controls,
|
||||
.main-log-filter-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.main-log-controls {
|
||||
flex: 1;
|
||||
justify-content: flex-end;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.main-log-filter-row {
|
||||
flex-wrap: wrap;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.main-log-level-filter {
|
||||
--accent: #4866b9;
|
||||
}
|
||||
|
||||
.main-log-toggle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
color: #aeb7df;
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.main-log-regex {
|
||||
flex: 1 1 340px;
|
||||
min-width: 220px;
|
||||
}
|
||||
|
||||
.main-log-copy-status {
|
||||
color: #8ee6a6;
|
||||
font-size: 12px;
|
||||
min-width: 64px;
|
||||
}
|
||||
|
||||
.main-log-load-error {
|
||||
flex-shrink: 0;
|
||||
color: #ff8a8a;
|
||||
font-size: 12px;
|
||||
font-family: Consolas, "Courier New", monospace;
|
||||
}
|
||||
|
||||
.main-log-stats {
|
||||
color: #8892b0;
|
||||
font-size: 12px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.main-log-viewport {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: auto;
|
||||
padding: 14px;
|
||||
border: 1px solid #2a3252;
|
||||
border-radius: 6px;
|
||||
background: #050813;
|
||||
font-family: Consolas, "Courier New", monospace;
|
||||
font-size: 12.5px;
|
||||
line-height: 1.42;
|
||||
}
|
||||
|
||||
.main-log-line {
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
color: #D5DBFE;
|
||||
}
|
||||
|
||||
.main-log-line.level-trace,
|
||||
.main-log-line.level-debug {
|
||||
color: #9aa6c8;
|
||||
}
|
||||
|
||||
.main-log-line.level-warn {
|
||||
color: #ffd37a;
|
||||
}
|
||||
|
||||
.main-log-line.level-error {
|
||||
color: #ff8a8a;
|
||||
}
|
||||
|
||||
.main-log-empty {
|
||||
color: #8892b0;
|
||||
padding: 8px 4px;
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.main-log-window {
|
||||
padding: 14px;
|
||||
}
|
||||
|
||||
.main-log-header {
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.main-log-controls {
|
||||
justify-content: flex-start;
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,278 @@
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
import { listen } from '@tauri-apps/api/event';
|
||||
|
||||
import { SegmentedRadio } from './components/SegmentedRadio';
|
||||
import {
|
||||
capLogRows,
|
||||
consumeLoadedHistoryRow,
|
||||
dedupeBufferedRows,
|
||||
formatCount,
|
||||
LEVEL_FILTER_MIN,
|
||||
LEVEL_FILTER_OPTIONS,
|
||||
LEVEL_ORDER,
|
||||
lineCountsFromRows,
|
||||
type LevelFilter,
|
||||
type MainLogHistoryPayload,
|
||||
type MainLogLinePayload,
|
||||
type MainLogRow,
|
||||
rowFromPayload,
|
||||
rowsFromHistory,
|
||||
} from './lib/mainLogs';
|
||||
|
||||
import './MainLogsWindow.css';
|
||||
|
||||
export const isMainLogsView = (): boolean =>
|
||||
new URLSearchParams(window.location.search).get('view') === 'main-logs';
|
||||
|
||||
export const MainLogsWindow = () => {
|
||||
const [logs, setLogs] = useState<MainLogRow[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [loadError, setLoadError] = useState<string | null>(null);
|
||||
const [regexInput, setRegexInput] = useState('');
|
||||
const [levelFilter, setLevelFilter] = useState<LevelFilter>('all');
|
||||
const [autoScroll, setAutoScroll] = useState(true);
|
||||
const [paused, setPaused] = useState(false);
|
||||
const [pausedBufferCount, setPausedBufferCount] = useState(0);
|
||||
const [copyStatus, setCopyStatus] = useState<string | null>(null);
|
||||
|
||||
const viewportRef = useRef<HTMLDivElement | null>(null);
|
||||
const historyLoadedRef = useRef(false);
|
||||
const initialBufferRef = useRef<MainLogRow[]>([]);
|
||||
const pausedBufferRef = useRef<MainLogRow[]>([]);
|
||||
const pausedRef = useRef(false);
|
||||
const lastHistorySequenceRef = useRef(0);
|
||||
const historyLineCountsRef = useRef<Map<string, number>>(new Map());
|
||||
|
||||
const appendVisibleRows = useCallback((rows: MainLogRow[]) => {
|
||||
setLogs(current => capLogRows([...current, ...rows]));
|
||||
}, []);
|
||||
|
||||
const bufferPausedRows = useCallback((rows: MainLogRow[]) => {
|
||||
pausedBufferRef.current = capLogRows([...pausedBufferRef.current, ...rows]);
|
||||
setPausedBufferCount(pausedBufferRef.current.length);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
let unlisten: (() => void) | undefined;
|
||||
|
||||
const handleIncomingRow = (row: MainLogRow) => {
|
||||
if (!historyLoadedRef.current) {
|
||||
initialBufferRef.current = capLogRows([...initialBufferRef.current, row]);
|
||||
return;
|
||||
}
|
||||
if (
|
||||
consumeLoadedHistoryRow(
|
||||
historyLineCountsRef.current,
|
||||
row,
|
||||
lastHistorySequenceRef.current,
|
||||
)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
if (pausedRef.current) {
|
||||
bufferPausedRows([row]);
|
||||
return;
|
||||
}
|
||||
appendVisibleRows([row]);
|
||||
};
|
||||
|
||||
const setup = async () => {
|
||||
try {
|
||||
unlisten = await listen<MainLogLinePayload>('main-log-line', event => {
|
||||
handleIncomingRow(rowFromPayload(event.payload));
|
||||
});
|
||||
|
||||
const history = await invoke<MainLogHistoryPayload>('get_main_logs');
|
||||
if (cancelled) return;
|
||||
|
||||
lastHistorySequenceRef.current = history.lastSequence;
|
||||
const historyRows = rowsFromHistory(history.contents);
|
||||
const historyLineCounts = lineCountsFromRows(historyRows);
|
||||
const liveRows = dedupeBufferedRows(
|
||||
historyLineCounts,
|
||||
initialBufferRef.current,
|
||||
lastHistorySequenceRef.current,
|
||||
);
|
||||
initialBufferRef.current = [];
|
||||
historyLineCountsRef.current = historyLineCounts;
|
||||
historyLoadedRef.current = true;
|
||||
|
||||
if (pausedRef.current) {
|
||||
setLogs(capLogRows(historyRows));
|
||||
bufferPausedRows(liveRows);
|
||||
} else {
|
||||
setLogs(capLogRows([...historyRows, ...liveRows]));
|
||||
}
|
||||
setLoadError(null);
|
||||
} catch (err) {
|
||||
if (!cancelled) {
|
||||
historyLoadedRef.current = true;
|
||||
setLoadError(err instanceof Error ? err.message : String(err));
|
||||
}
|
||||
} finally {
|
||||
if (!cancelled) {
|
||||
setLoading(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void setup();
|
||||
|
||||
return () => {
|
||||
cancelled = true;
|
||||
historyLoadedRef.current = false;
|
||||
initialBufferRef.current = [];
|
||||
lastHistorySequenceRef.current = 0;
|
||||
historyLineCountsRef.current = new Map();
|
||||
unlisten?.();
|
||||
};
|
||||
}, [appendVisibleRows, bufferPausedRows]);
|
||||
|
||||
const { regex, regexError } = useMemo(() => {
|
||||
if (!regexInput) {
|
||||
return { regex: null as RegExp | null, regexError: null as string | null };
|
||||
}
|
||||
try {
|
||||
return { regex: new RegExp(regexInput, 'i'), regexError: null };
|
||||
} catch (e) {
|
||||
return { regex: null, regexError: e instanceof Error ? e.message : String(e) };
|
||||
}
|
||||
}, [regexInput]);
|
||||
|
||||
const filteredRows = useMemo(() => {
|
||||
const minLevel = LEVEL_FILTER_MIN[levelFilter];
|
||||
return logs.filter(row => {
|
||||
if (LEVEL_ORDER[row.level] < minLevel) return false;
|
||||
return regex ? regex.test(row.line) : true;
|
||||
});
|
||||
}, [levelFilter, logs, regex]);
|
||||
|
||||
const lastVisibleRow = filteredRows.length > 0 ? filteredRows[filteredRows.length - 1] : null;
|
||||
|
||||
useEffect(() => {
|
||||
if (!autoScroll) return;
|
||||
const viewport = viewportRef.current;
|
||||
if (!viewport) return;
|
||||
|
||||
requestAnimationFrame(() => {
|
||||
viewport.scrollTop = viewport.scrollHeight;
|
||||
});
|
||||
}, [autoScroll, filteredRows.length, lastVisibleRow?.id]);
|
||||
|
||||
const flushPausedRows = useCallback(() => {
|
||||
const buffered = pausedBufferRef.current;
|
||||
if (buffered.length === 0) return;
|
||||
pausedBufferRef.current = [];
|
||||
setPausedBufferCount(0);
|
||||
appendVisibleRows(buffered);
|
||||
}, [appendVisibleRows]);
|
||||
|
||||
const togglePaused = useCallback(() => {
|
||||
if (paused) {
|
||||
pausedRef.current = false;
|
||||
setPaused(false);
|
||||
flushPausedRows();
|
||||
return;
|
||||
}
|
||||
|
||||
pausedRef.current = true;
|
||||
setPaused(true);
|
||||
}, [flushPausedRows, paused]);
|
||||
|
||||
const clearLogs = useCallback(() => {
|
||||
setLogs([]);
|
||||
initialBufferRef.current = [];
|
||||
pausedBufferRef.current = [];
|
||||
setPausedBufferCount(0);
|
||||
}, []);
|
||||
|
||||
const copyFilteredLogs = useCallback(async () => {
|
||||
try {
|
||||
await navigator.clipboard.writeText(filteredRows.map(row => row.line).join('\n'));
|
||||
setCopyStatus('Copied');
|
||||
} catch {
|
||||
setCopyStatus('Copy failed');
|
||||
}
|
||||
window.setTimeout(() => setCopyStatus(null), 1600);
|
||||
}, [filteredRows]);
|
||||
|
||||
return (
|
||||
<main className="main-log-window">
|
||||
<div className="main-log-header">
|
||||
<h1>Application Logs</h1>
|
||||
<div className="main-log-controls">
|
||||
<label className="main-log-toggle">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={autoScroll}
|
||||
onChange={(e) => setAutoScroll(e.target.checked)}
|
||||
/>
|
||||
Auto-scroll
|
||||
</label>
|
||||
<button className="settings-button" onClick={togglePaused}>
|
||||
{paused ? 'Resume' : 'Pause'}
|
||||
</button>
|
||||
<button className="settings-button" onClick={clearLogs} disabled={logs.length === 0}>
|
||||
Clear
|
||||
</button>
|
||||
<button
|
||||
className="settings-button"
|
||||
onClick={() => void copyFilteredLogs()}
|
||||
disabled={filteredRows.length === 0}
|
||||
>
|
||||
Copy
|
||||
</button>
|
||||
{copyStatus && <span className="main-log-copy-status">{copyStatus}</span>}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="main-log-filter-row">
|
||||
<div className="main-log-level-filter">
|
||||
<SegmentedRadio
|
||||
value={levelFilter}
|
||||
options={LEVEL_FILTER_OPTIONS}
|
||||
onChange={setLevelFilter}
|
||||
/>
|
||||
</div>
|
||||
<input
|
||||
className={`unpack-log-regex main-log-regex ${regexError ? 'invalid' : ''}`}
|
||||
type="text"
|
||||
placeholder="Filter lines by regex (case-insensitive)..."
|
||||
value={regexInput}
|
||||
onChange={(e) => setRegexInput(e.target.value)}
|
||||
title={regexError ?? ''}
|
||||
spellCheck={false}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{regexError && (
|
||||
<div className="unpack-log-regex-error">regex error: {regexError}</div>
|
||||
)}
|
||||
{loadError && (
|
||||
<div className="main-log-load-error">load error: {loadError}</div>
|
||||
)}
|
||||
|
||||
<div className="main-log-stats">
|
||||
{loading ? 'loading' : `showing ${formatCount(filteredRows.length, 'line')} of ${formatCount(logs.length, 'line')}`}
|
||||
{paused && pausedBufferCount > 0 && ` - ${formatCount(pausedBufferCount, 'paused line')}`}
|
||||
</div>
|
||||
|
||||
<section ref={viewportRef} className="main-log-viewport" aria-live={paused ? 'off' : 'polite'}>
|
||||
{filteredRows.length === 0 ? (
|
||||
<div className="main-log-empty">
|
||||
{logs.length === 0 ? 'No application logs recorded yet.' : 'No log lines match the current filters.'}
|
||||
</div>
|
||||
) : filteredRows.map(row => (
|
||||
<div
|
||||
key={row.id}
|
||||
className={`main-log-line level-${row.level.toLowerCase()}`}
|
||||
>
|
||||
{row.line}
|
||||
</div>
|
||||
))}
|
||||
</section>
|
||||
</main>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,148 @@
|
||||
export const LOG_LEVELS = ['TRACE', 'DEBUG', 'INFO', 'WARN', 'ERROR'] as const;
|
||||
export type LogLevel = typeof LOG_LEVELS[number];
|
||||
export type LevelFilter = 'all' | 'debug' | 'info' | 'warn' | 'error';
|
||||
|
||||
export interface MainLogLinePayload {
|
||||
line: string;
|
||||
level: string;
|
||||
sequence?: number | null;
|
||||
}
|
||||
|
||||
export interface MainLogHistoryPayload {
|
||||
contents: string;
|
||||
lastSequence: number;
|
||||
}
|
||||
|
||||
export interface MainLogRow {
|
||||
id: string;
|
||||
line: string;
|
||||
level: LogLevel;
|
||||
sequence?: number;
|
||||
}
|
||||
|
||||
export const LEVEL_ORDER: Record<LogLevel, number> = {
|
||||
TRACE: 0,
|
||||
DEBUG: 1,
|
||||
INFO: 2,
|
||||
WARN: 3,
|
||||
ERROR: 4,
|
||||
};
|
||||
|
||||
export const LEVEL_FILTER_MIN: Record<LevelFilter, number> = {
|
||||
all: LEVEL_ORDER.TRACE,
|
||||
debug: LEVEL_ORDER.DEBUG,
|
||||
info: LEVEL_ORDER.INFO,
|
||||
warn: LEVEL_ORDER.WARN,
|
||||
error: LEVEL_ORDER.ERROR,
|
||||
};
|
||||
|
||||
export const LEVEL_FILTER_OPTIONS: ReadonlyArray<{ value: LevelFilter; label: string }> = [
|
||||
{ value: 'all', label: 'All' },
|
||||
{ value: 'debug', label: 'Debug+' },
|
||||
{ value: 'info', label: 'Info+' },
|
||||
{ value: 'warn', label: 'Warn+' },
|
||||
{ value: 'error', label: 'Error only' },
|
||||
];
|
||||
|
||||
const MAX_IN_MEMORY_LOG_ROWS = 12_000;
|
||||
const MAX_IN_MEMORY_LOG_CHARS = 2 * 1024 * 1024;
|
||||
|
||||
let nextSyntheticLogRowId = 0;
|
||||
|
||||
const syntheticLogRowId = (): string => {
|
||||
nextSyntheticLogRowId += 1;
|
||||
return `live-synthetic-${nextSyntheticLogRowId}`;
|
||||
};
|
||||
|
||||
const isLogLevel = (value: string | undefined): value is LogLevel =>
|
||||
typeof value === 'string' && (LOG_LEVELS as readonly string[]).includes(value);
|
||||
|
||||
export const normalizeLogLevel = (value: string | undefined): LogLevel => {
|
||||
const upper = value?.toUpperCase();
|
||||
return isLogLevel(upper) ? upper : 'INFO';
|
||||
};
|
||||
|
||||
export const parseLogLevelFromLine = (line: string): LogLevel => {
|
||||
const match = line.match(/\[(TRACE|DEBUG|INFO|WARN|ERROR)\](?:\s|$)/);
|
||||
return normalizeLogLevel(match?.[1]);
|
||||
};
|
||||
|
||||
export const rowFromPayload = (payload: MainLogLinePayload): MainLogRow => {
|
||||
const sequence = typeof payload.sequence === 'number' ? payload.sequence : undefined;
|
||||
|
||||
return {
|
||||
id: sequence === undefined ? syntheticLogRowId() : `live-${sequence}`,
|
||||
line: payload.line,
|
||||
level: normalizeLogLevel(payload.level),
|
||||
sequence,
|
||||
};
|
||||
};
|
||||
|
||||
export const rowsFromHistory = (text: string): MainLogRow[] =>
|
||||
text
|
||||
.split(/\r?\n/)
|
||||
.filter(line => line.length > 0)
|
||||
.map((line, index) => ({
|
||||
id: `history-${index}`,
|
||||
line,
|
||||
level: parseLogLevelFromLine(line),
|
||||
}));
|
||||
|
||||
export const capLogRows = (rows: MainLogRow[]): MainLogRow[] => {
|
||||
let charCount = 0;
|
||||
const capped: MainLogRow[] = [];
|
||||
|
||||
for (let index = rows.length - 1; index >= 0; index -= 1) {
|
||||
const row = rows[index];
|
||||
const rowChars = row.line.length + 1;
|
||||
const wouldExceedRows = capped.length >= MAX_IN_MEMORY_LOG_ROWS;
|
||||
const wouldExceedChars = charCount + rowChars > MAX_IN_MEMORY_LOG_CHARS;
|
||||
if (wouldExceedRows || (wouldExceedChars && capped.length > 0)) {
|
||||
break;
|
||||
}
|
||||
|
||||
capped.push(row);
|
||||
charCount += rowChars;
|
||||
}
|
||||
|
||||
return capped.reverse();
|
||||
};
|
||||
|
||||
export const rowWasLoadedInHistory = (row: MainLogRow, lastHistorySequence: number): boolean =>
|
||||
typeof row.sequence === 'number' && row.sequence <= lastHistorySequence;
|
||||
|
||||
export const lineCountsFromRows = (rows: MainLogRow[]): Map<string, number> => {
|
||||
const lineCounts = new Map<string, number>();
|
||||
rows.forEach(row => {
|
||||
lineCounts.set(row.line, (lineCounts.get(row.line) ?? 0) + 1);
|
||||
});
|
||||
return lineCounts;
|
||||
};
|
||||
|
||||
export const consumeLoadedHistoryRow = (
|
||||
historyLineCounts: Map<string, number>,
|
||||
row: MainLogRow,
|
||||
lastHistorySequence: number,
|
||||
): boolean => {
|
||||
if (!rowWasLoadedInHistory(row, lastHistorySequence)) return false;
|
||||
|
||||
const count = historyLineCounts.get(row.line) ?? 0;
|
||||
if (count <= 0) return false;
|
||||
|
||||
if (count === 1) {
|
||||
historyLineCounts.delete(row.line);
|
||||
} else {
|
||||
historyLineCounts.set(row.line, count - 1);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
export const dedupeBufferedRows = (
|
||||
historyLineCounts: Map<string, number>,
|
||||
bufferedRows: MainLogRow[],
|
||||
lastHistorySequence: number,
|
||||
): MainLogRow[] =>
|
||||
bufferedRows.filter(row => !consumeLoadedHistoryRow(historyLineCounts, row, lastHistorySequence));
|
||||
|
||||
export const formatCount = (count: number, noun: string): string =>
|
||||
`${count.toLocaleString()} ${noun}${count === 1 ? '' : 's'}`;
|
||||
@@ -43,6 +43,29 @@ const openLogsWindow = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
const openMainLogsWindow = async () => {
|
||||
const { WebviewWindow } = await import('@tauri-apps/api/webviewWindow');
|
||||
try {
|
||||
const existing = await WebviewWindow.getByLabel('main-logs');
|
||||
if (existing) {
|
||||
await existing.setFocus();
|
||||
return;
|
||||
}
|
||||
const win = new WebviewWindow('main-logs', {
|
||||
url: '/?view=main-logs',
|
||||
title: 'Application Logs',
|
||||
width: 980,
|
||||
height: 720,
|
||||
resizable: true,
|
||||
});
|
||||
await win.once<unknown>('tauri://error', (event) => {
|
||||
console.error('Error opening application logs window:', event.payload);
|
||||
});
|
||||
} catch (err) {
|
||||
console.error('Error opening application logs window:', err);
|
||||
}
|
||||
};
|
||||
|
||||
export const MainWindow = () => {
|
||||
const { settings, set: setSetting } = useSettings();
|
||||
const { gameDir, hasGameDirectory, setGameDir, rescan } = useGameDirectory();
|
||||
@@ -107,6 +130,7 @@ export const MainWindow = () => {
|
||||
{ kind: 'item', label: 'Settings', onClick: () => setSettingsOpen(true) },
|
||||
{ kind: 'item', label: 'Refresh library', onClick: () => rescan() },
|
||||
{ kind: 'separator' },
|
||||
{ kind: 'item', label: 'Application logs', onClick: () => void openMainLogsWindow() },
|
||||
{ kind: 'item', label: 'Unpack logs', onClick: () => void openLogsWindow() },
|
||||
], [rescan]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user