some clean up and added a all log option

This commit is contained in:
Anirban Kar
2024-12-13 20:48:33 +05:30
parent d13da30bda
commit 77b47c1ce6
4 changed files with 1343 additions and 1302 deletions

View File

@@ -1 +1 @@
{ "commit": "4ba5d37fcd16414a06dbeba56c7732173e734c63" }
{ "commit": "d13da30bda2d10eb2da42113493625cd55e0d34d" }

View File

@@ -9,7 +9,7 @@ import { classNames } from '~/utils/classNames';
export default function EventLogsTab() {
const {} = useSettings();
const showLogs = useStore(logStore.showLogs);
const [logLevel, setLogLevel] = useState<LogEntry['level']>('info');
const [logLevel, setLogLevel] = useState<LogEntry['level'] | 'all'>('info');
const [autoScroll, setAutoScroll] = useState(true);
const [searchQuery, setSearchQuery] = useState('');
const [, forceUpdate] = useState({});
@@ -17,7 +17,7 @@ export default function EventLogsTab() {
const filteredLogs = useMemo(() => {
const logs = logStore.getLogs();
return logs.filter((log) => {
const matchesLevel = !logLevel || log.level === logLevel;
const matchesLevel = !logLevel || log.level === logLevel || logLevel === 'all';
const matchesSearch =
!searchQuery ||
log.message?.toLowerCase().includes(searchQuery.toLowerCase()) ||
@@ -143,6 +143,7 @@ export default function EventLogsTab() {
onChange={(e) => setLogLevel(e.target.value as LogEntry['level'])}
className="flex-1 p-2 rounded-lg border border-bolt-elements-borderColor bg-bolt-elements-prompt-background text-bolt-elements-textPrimary focus:outline-none focus:ring-2 focus:ring-bolt-elements-focus transition-all lg:max-w-[20%] text-sm min-w-[100px]"
>
<option value="all">All</option>
<option value="info">Info</option>
<option value="warning">Warning</option>
<option value="error">Error</option>