feat(log): 日志等级

This commit is contained in:
YuleBest committed 2026-04-10 08:23:55 +08:00
1 parent ae42b7f0f2
commit 66ff3a6429
9 files changed
+74 -7

No files matched your search

+15
View File
@@ -1,3 +1,16 @@
## V2.3-2301
- 新增: 引入 Rust 编写的 `lumipro` 二进制程序,取代 `inotifyd` 作为亮度文件监听器,内置防抖动与调试模式,提升稳定性
- 新增: HDR 内容避让功能,播放 HDR 视频时自动退让亮度提升
- 新增: 日志等级配置,支持 关闭 / 仅错误 / 警告+ / 全部,有效减少日志量
- 新增: 活动级黑名单功能,可指定应用在前台时禁止模块提升亮度
- 重构: 配置文件由多个独立文本文件合并为单一 `config.json`
- 重构: Web UI 前端框架升级为 Vue 3 + Vite,组件化重构全部页面
- 新增: Web UI 界面缩放、日志导出、设置卡片折叠、header 自动收起等功能
- 优化: Web UI 页面切换动画、亮度进度条动画、底栏导航动画
- 修复: 日志关键字过滤不生效的问题
- 修复: 修复其他已知问题
## v2.2-2208
- 新增: 黑名单功能,可在指定应用内禁止模块工作
@@ -20,6 +33,7 @@
## V2.2-2202
### 核心逻辑
- 新增: `action.sh` 支持模块管理器“操作”按钮点击快速切换开关状态
- 新增: `stop.flag` 机制,支持在不重启服务的情况下拦截亮度提升逻辑
- 重构: `up.sh` 逻辑,支持日志内容比对刷新及文件大小自动截断
@@ -29,6 +43,7 @@
- 完善 `customize.sh` 的迁移逻辑,支持从 2101 版本自动补全缺失配置及备份目录
### WebUI
- 重构: 将配置划分为“亮度调节”、“执行策略”及“系统管理”三大板块
- 优化: 移除手动刷新按钮,实现 0.5s 频率的实时动态状态与日志监控
- 优化: “定时休眠”采用开关折叠设计,优化窄屏移动端布局
+4
View File
@@ -68,6 +68,7 @@ write_config_json() {
--arg inotify_events "${cfg_inotify_events:-c}" \
--arg now_bri_file "${cfg_now_bri_file:-$DEFAULT_NOW_BRI_FILE}" \
--arg max_bri_file "${cfg_max_bri_file:-$DEFAULT_MAX_BRI_FILE}" \
--arg log_level "${cfg_log_level:-info}" \
--argjson blacklist_apps "${cfg_blacklist_apps:-[]}" \
'{
ui_max_bri: ($ui_max_bri | tonumber),
@@ -80,6 +81,7 @@ write_config_json() {
inotify_events: $inotify_events,
now_bri_file: $now_bri_file,
max_bri_file: $max_bri_file,
log_level: $log_level,
blacklist_apps: $blacklist_apps
}' >"$CONFIG_FILE"
}
@@ -291,6 +293,7 @@ INIT_CONFIG() {
cfg_now_bri_file="$DEFAULT_NOW_BRI_FILE"
cfg_max_bri_file="$DEFAULT_MAX_BRI_FILE"
cfg_blacklist_apps="[]"
cfg_log_level="info"
write_config_json
fi
}
@@ -304,6 +307,7 @@ ENSURE_DEFAULTS() {
.display_hdr_sleep = (.display_hdr_sleep // 0) |
.sleep_time = (.sleep_time // "") |
.inotify_events = (.inotify_events // "c") |
.log_level = (.log_level // "info") |
.blacklist_apps = (.blacklist_apps // [])
' "$CONFIG_FILE" >"$CONFIG_FILE.tmp" && mv "$CONFIG_FILE.tmp" "$CONFIG_FILE"
}
+2 -2
View File
@@ -1,7 +1,7 @@
id=LuminPro
name=LuminPro丨日用屏幕亮度强化
version=V2.2-2208
versionCode=2208
version=V2.3-2301
versionCode=2301
author=酷安@Yule
description=本模块旨在让你的 Android 设备随时可以使用高亮度显示屏幕内容。无论设备当前亮度如何,只要满足设定的前台触发亮度条件,模块便会自动且平滑地提升屏幕亮度至硬件支持的峰值状态,确保你在强光室外也能获得清晰的显示效果
updateJson=https://raw.githubusercontent.com/YuleBest/LuminPro/main/update.json
+7
View File
@@ -36,6 +36,13 @@ get_config_hash() {
_log() {
local level="${2:-INFO}"
local ll
ll="$(get_cfg log_level "info")"
case "$ll" in
off) return ;;
error) case "$level" in ERROR) ;; *) return ;; esac ;;
warn) case "$level" in ERROR | WARN) ;; *) return ;; esac ;;
esac
printf '[%s] [%s] [%s] %s\n' "$(date '+%m-%d %H:%M:%S')" "daemon" "$level" "$1" >>"$log_file"
}
+7
View File
@@ -22,6 +22,7 @@ get_cfg() {
}
now_bri_file="$(get_cfg now_bri_file "$DEFAULT_NOW_BRI_FILE")"
log_level="$(get_cfg log_level "info")"
_log() {
local level="${2:-INFO}"
@@ -31,6 +32,12 @@ _log() {
*) if [ -f "$stop_file" ]; then return; fi ;;
esac
case "$log_level" in
off) return ;;
error) case "$level" in ERROR) ;; *) return ;; esac ;;
warn) case "$level" in ERROR | WARN) ;; *) return ;; esac ;;
esac
local max_size
max_size="$(get_cfg log_max_size 500)"
if [ -f "$log_file" ]; then
+7
View File
@@ -21,6 +21,13 @@ get_cfg() {
_log() {
local level="${2:-INFO}"
local ll
ll="$(get_cfg log_level "info")"
case "$ll" in
off) return ;;
error) case "$level" in ERROR) ;; *) return ;; esac ;;
warn) case "$level" in ERROR | WARN) ;; *) return ;; esac ;;
esac
printf '[%s] [%s] [%s] %s\n' "$(date '+%m-%d %H:%M:%S')" "service" "$level" "$1" >>"$log_file"
}
+5 -5
View File
@@ -1,6 +1,6 @@
{
"versionCode": 2208,
"version": "V2.2-2208",
"zipUrl": "https://share.yule.ink/magisk/mod/luminpro/module/LuminPro_V2.2-2208.zip",
"changelog": "https://raw.githubusercontent.com/YuleBest/LuminPro/main/changelog.md"
}
"versionCode": 2208,
"version": "V2.2-2208",
"zipUrl": "https://share.yule.ink/magisk/mod/luminpro/module/LuminPro_V2.2-2208.zip",
"changelog": "https://raw.githubusercontent.com/YuleBest/LuminPro/main/changelog.md"
}
+4
View File
@@ -32,6 +32,7 @@ export function useConfig() {
const sysMaxBriFile = ref(DEFAULT_SYS_MAX_BRI_FILE)
const inotifyEvents = ref('c')
const debugMode = ref(false)
const logLevel = ref('info')
// Web UI 配置 (localStorage 持久化)
const autoRefresh = ref(localStorage.getItem('autoRefresh') !== 'false')
@@ -57,6 +58,7 @@ export function useConfig() {
sysMaxBriFile.value = cfg.max_bri_file || DEFAULT_SYS_MAX_BRI_FILE
inotifyEvents.value = cfg.inotify_events || 'c'
debugMode.value = cfg.debug_mode === 1
logLevel.value = cfg.log_level || 'info'
const st = cfg.sleep_time || ''
if (st && st.includes('-')) {
@@ -98,6 +100,7 @@ export function useConfig() {
auto_bri_sleep: autoBriSleep.value ? 1 : 0,
display_hdr_sleep: displayHdrSleep.value ? 1 : 0,
sleep_time: getSleepTimeStr(),
log_level: logLevel.value,
})
await runCmd(`rm -f "${FLAG_FILE}"`)
const pidRes = await runCmd(`cat "${PID_FILE}"`)
@@ -211,6 +214,7 @@ export function useConfig() {
sysMaxBriFile,
inotifyEvents,
debugMode,
logLevel,
autoRefresh,
statusRefreshInterval,
uiZoom,
+23
View File
@@ -208,6 +208,29 @@ function handleSaveWebUI() {
class="config-input"
/>
</div>
<div class="config-item">
<div class="config-label">
<span class="config-name">日志等级</span>
<span class="config-desc">低于该等级的日志不写入文件</span>
</div>
<div class="theme-seg">
<button
v-for="opt in [
{ v: 'off', l: '关闭' },
{ v: 'error', l: '错误' },
{ v: 'warn', l: '警告' },
{ v: 'info', l: '全部' },
]"
:key="opt.v"
class="theme-seg-btn"
:class="{ active: config.logLevel.value === opt.v }"
@click="config.logLevel.value = opt.v"
>
{{ opt.l }}
</button>
</div>
</div>
</div>
<div class="card-actions">