Revert "feat: enhance log filtering by adding support for debug level and updating log hierarchy #4293"

This reverts commit a9cfb2cfaa.
This commit is contained in:
Tunglies
2025-08-08 15:15:49 +08:00
Unverified
parent 6a93ff1fc1
commit 319c5b84fa
5 changed files with 14 additions and 39 deletions

View File

@@ -110,10 +110,10 @@ jobs:
MONTH=$(date +%m)
DAY=$(date +%d)
AUTOBUILD_VERSION="${CURRENT_BASE_VERSION}+autobuild.${MONTH}${DAY}.${LAST_TAURI_COMMIT}"
echo "🏷️ Autobuild version: $AUTOBUILD_VERSION"
echo "📝 Last Tauri commit: $LAST_TAURI_COMMIT"
# Set outputs for other jobs to use
echo "last_tauri_commit=$LAST_TAURI_COMMIT" >> $GITHUB_OUTPUT
echo "autobuild_version=$AUTOBUILD_VERSION" >> $GITHUB_OUTPUT
@@ -264,7 +264,7 @@ jobs:
# Use consistent values from check_commit job
CURRENT_AUTOBUILD_VERSION="${{ needs.check_commit.outputs.autobuild_version }}"
LAST_TAURI_COMMIT="${{ needs.check_commit.outputs.last_tauri_commit }}"
echo "📦 Current autobuild version: $CURRENT_AUTOBUILD_VERSION"
echo "📝 Last Tauri commit: $LAST_TAURI_COMMIT"

View File

@@ -234,19 +234,6 @@ impl LogsMonitor {
// Filter logs based on level if needed
let should_include = match filter_level {
"all" => true,
"debug" => true, // DEBUG level should include all log types
"info" => {
let log_type = log_data.log_type.to_lowercase();
matches!(log_type.as_str(), "info" | "warning" | "error")
}
"warning" => {
let log_type = log_data.log_type.to_lowercase();
matches!(log_type.as_str(), "warning" | "error")
}
"error" => {
let log_type = log_data.log_type.to_lowercase();
log_type == "error"
}
level => log_data.log_type.to_lowercase() == level.to_lowercase(),
};
@@ -295,22 +282,10 @@ impl LogsMonitor {
.iter()
.filter(|log| {
if let Some(ref filter_level) = level {
match filter_level.as_str() {
"all" => true,
"debug" => true, // DEBUG level should include all log types
"info" => {
let log_type = log.log_type.to_lowercase();
matches!(log_type.as_str(), "info" | "warning" | "error")
}
"warning" => {
let log_type = log.log_type.to_lowercase();
matches!(log_type.as_str(), "warning" | "error")
}
"error" => {
let log_type = log.log_type.to_lowercase();
log_type == "error"
}
level => log.log_type.to_lowercase() == level.to_lowercase(),
if filter_level == "all" {
true
} else {
log.log_type.to_lowercase() == filter_level.to_lowercase()
}
} else {
true

View File

@@ -29,9 +29,6 @@ const Item = styled(Box)(({ theme: { palette, typography } }) => ({
'& .type[data-type="info"], & .type[data-type="inf"]': {
color: palette.info.main,
},
'& .type[data-type="debug"], & .type[data-type="dbg"]': {
color: palette.text.secondary,
},
"& .data": {
color: palette.text.primary,
overflowWrap: "anywhere",

View File

@@ -30,7 +30,7 @@ const LOG_LEVEL_HIERARCHY = {
info: ["info", "warning", "error"],
warning: ["warning", "error"],
error: ["error"],
debug: ["info", "warning", "error", "debug"],
debug: ["debug"],
};
const LogPage = () => {

View File

@@ -185,7 +185,10 @@ export const clearGlobalLogs = () => {
export const useGlobalLogData = (logLevel: LogLevel = "all") => {
const logs = useGlobalLogStore((state) => state.logs);
// 日志已经在后端根据级别进行了过滤,这里直接返回所有日志
// 不需要在前端再次过滤避免重复过滤导致DEBUG日志丢失
return logs;
// 根据当前选择的日志等级过滤日志
if (logLevel === "all") {
return logs;
} else {
return logs.filter((log) => log.type.toLowerCase() === logLevel);
}
};