From d0619fecdd1044576d804cdf1c08d39b5c6eaa43 Mon Sep 17 00:00:00 2001 From: Oscar Beaumont Date: Fri, 13 Oct 2023 19:50:01 +1100 Subject: [PATCH] Reduce production logs + button on error page for logs (#1565) * reduce prod logs * Open logs dir button on error page --- core/src/lib.rs | 7 ++++++- interface/ErrorFallback.tsx | 16 +++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/core/src/lib.rs b/core/src/lib.rs index 1bfd38389..20c4f98a3 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -169,7 +169,12 @@ impl Node { .with( tracing_fmt::Subscriber::new() .with_ansi(false) - .with_writer(logfile), + .with_writer(logfile) + .with_filter( + EnvFilter::builder() + .from_env()? + .add_directive("info".parse()?), + ), ) .with( tracing_fmt::Subscriber::new() diff --git a/interface/ErrorFallback.tsx b/interface/ErrorFallback.tsx index 75f0dc558..d31f3bee4 100644 --- a/interface/ErrorFallback.tsx +++ b/interface/ErrorFallback.tsx @@ -6,6 +6,7 @@ import { Button, Dialogs } from '@sd/ui'; import { showAlertDialog } from './components'; import { useOperatingSystem, useTheme } from './hooks'; +import { usePlatform } from './util/Platform'; export function RouterErrorBoundary() { const error = useRouteError(); @@ -56,6 +57,7 @@ export function ErrorPage({ useTheme(); const debug = useDebugState(); const os = useOperatingSystem(); + const platform = usePlatform(); const isMacOS = os === 'macOS'; const resetHandler = () => { @@ -97,11 +99,19 @@ export function ErrorPage({ Reload )} - {sendReportBtn && ( - + {platform.openLogsDir && ( + )} + {(errorsThatRequireACoreReset.includes(message) || message.startsWith('NodeError::FailedToInitializeConfig') || message.startsWith('failed to initialize library manager')) && (