The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.
Rust ffmpegfree-video-editormodel-context-protocolnon-linear-editoroffline-firstopen-source-video-editorself-hostedvideo-editingvideo-editing-automationvideo-editing-softwarevideo-editing-toolsvideo-editorvoice-cloningyoutube-automationyoutube-shorts
feat(logs): the log says why a GPU device died, and Settings says how much the log records
Jareer0699b44bee44
diff --git a/src/crates/concat-export/src/lib.rs b/src/crates/concat-export/src/lib.rsindex 7049221b..69cccba9 100644--- a/src/crates/concat-export/src/lib.rs+++ b/src/crates/concat-export/src/lib.rs@@ -1438,6 +1438,13 @@ fn render_picture();while compositor.lost() {losses += 1;+ let adapter = compositor.adapter_info();+ log::error!(+ "export: the GPU device on {} was lost drawing frame {index} of {total_frames} \+ ({:.3}s into the cut); the frame is drawn again on the next device",+ adapter.name,+ time.as_f64(),+ );compositor = recovered(losses, hdr)?;composed = composite_treated(&mut compositor,diff --git a/src/crates/concat-host/src/logs.rs b/src/crates/concat-host/src/logs.rsindex 5e7b2ab3..e05d39c7 100644--- a/src/crates/concat-host/src/logs.rs+++ b/src/crates/concat-host/src/logs.rs@@ -181,20 +181,49 @@ fn prune(folder: &Path) {}fn level_from_environment() -> log::LevelFilter {- match std::env::var(LEVEL_VARIABLE)- .unwrap_or_default()- .to_ascii_lowercase()- .as_str()- {+ environment_level().unwrap_or(log::LevelFilter::Info)+}++/// The level `CONCAT_LOG` names, when it names one: a run's own ceiling,+/// over the one the Settings sheet remembers.+pub fn environment_level() -> Option<log::LevelFilter> {+ level_named(&std::env::var(LEVEL_VARIABLE).unwrap_or_default())+}++/// A level by the name the environment and the preferences use: `error`,+/// `warn`, `info`, `debug`, `trace` or `off`, in any case.+pub fn level_named(name: &str) -> Option<log::LevelFilter> {+ Some(match name.trim().to_ascii_lowercase().as_str() {"error" => log::LevelFilter::Error,"warn" => log::LevelFilter::Warn,+ "info" => log::LevelFilter::Info,"debug" => log::LevelFilter::Debug,"trace" => log::LevelFilter::Trace,"off" => log::LevelFilter::Off,- _ => log::LevelFilter::Info,+ _ => return None,+ })+}++/// The name [`level_named`] reads back.+pub fn level_name(level: log::LevelFilter) -> &'static str {+ match level {+ log::LevelFilter::Error => "error",+ log::LevelFilter::Warn => "warn",+ log::LevelFilter::Info => "info",+ log::LevelFilter::Debug => "debug",+ log::LevelFilter::Trace => "trace",+ log::LevelFilter::Off => "off",}}+/// Sets the level for the rest of the run - the Settings sheet's choice,+/// or the remembered one applied at launch - and says so in the log, at+/// a level every setting but Off lets through.+pub fn set_level(level: log::LevelFilter) {+ log::set_max_level(level);+ log::error!("log level: {level}");+}+/// The open file and how much of its allowance is gone.struct Sink {file: std::fs::File,diff --git a/src/crates/concat-render/src/gpu.rs b/src/crates/concat-render/src/gpu.rsindex b96d7026..14b4035a 100644--- a/src/crates/concat-render/src/gpu.rs+++ b/src/crates/concat-render/src/gpu.rs@@ -780,6 +780,11 @@ impl WgpuCompositor {let (device, queue) =pollster::block_on(adapter.request_device(&wgpu::DeviceDescriptor::default())).ok()?;+ // The reason, when it dies, in the log: see the window's device.+ let name = adapter.get_info().name;+ device.set_device_lost_callback(move |reason, message| {+ log::error!("the compositor's GPU device on {name} was lost ({reason:?}): {message}");+ });Some(Self::with_device(device, queue))})}@@ -3431,15 +3436,22 @@ impl WgpuCompositor {slice.map_async(wgpu::MapMode::Read, move |result| {let _ = mapped_tx.send(result);});- if self- .device- .poll(wgpu::PollType::wait_indefinitely())- .is_err()- {+ // Each way the readback fails is said: these are the lines behind+ // "the GPU device was lost", and there were none (#223).+ if let Err(error) = self.device.poll(wgpu::PollType::wait_indefinitely()) {+ log::error!("GPU readback: the device did not finish the frame: {error}");return None;}- if !matches!(mapped_rx.try_recv(), Ok(Ok(()))) {- return None;+ match mapped_rx.try_recv() {+ Ok(Ok(())) => {}+ Ok(Err(error)) => {+ log::error!("GPU readback: the frame's buffer would not map: {error}");+ return None;+ }+ Err(_) => {+ log::error!("GPU readback: the device finished without answering the map");+ return None;+ }}if deep {diff --git a/src/crates/concat/locales/de.json b/src/crates/concat/locales/de.jsonindex b8cdbe6a..9b017840 100644--- a/src/crates/concat/locales/de.json+++ b/src/crates/concat/locales/de.json@@ -733,6 +733,13 @@"settings.installedMbOnDisk": "{0} installiert · {1} MB belegt","settings.installerOpened": "Das Installationsprogramm für Concat {0} ist geöffnet. Concat wird jetzt geschlossen, damit es fertig werden kann.","settings.language": "Sprache",+ "settings.logLevel": "Protokollstufe",+ "settings.logLevelHint": "Was das Protokoll festhält. Normal reicht für die meisten Berichte; Debug oder Alles, wenn ein Bericht danach fragt - die Datei wächst dann schneller. CONCAT_LOG in der Umgebung übersteuert dies für einen Lauf.",+ "settings.logErrors": "Nur Fehler",+ "settings.logWarnings": "Warnungen",+ "settings.logNormal": "Normal",+ "settings.logDebug": "Debug",+ "settings.logEverything": "Alles","settings.light": "Hell","settings.lime": "Limette","settings.lineAcrossLanesMarks": "Die Linie quer über die Spuren, die die aktuelle Zeit markiert. Wähle eine beliebige Farbe dafür, oder den ersten Punkt, um zur Farbe des Designs zurückzukehren.",diff --git a/src/crates/concat/locales/en.json b/src/crates/concat/locales/en.jsonindex acba048c..3535c6e5 100644--- a/src/crates/concat/locales/en.json+++ b/src/crates/concat/locales/en.json@@ -733,6 +733,13 @@"settings.installedMbOnDisk": "{0} installed · {1} MB on disk","settings.installerOpened": "The installer for Concat {0} is open. Concat closes now so it can finish.","settings.language": "Language",+ "settings.logLevel": "Log level",+ "settings.logLevelHint": "What the log records. Normal is enough for most reports; Debug or Everything when a report asks for it, and the file grows faster. CONCAT_LOG in the environment overrides this for one run.",+ "settings.logErrors": "Errors only",+ "settings.logWarnings": "Warnings",+ "settings.logNormal": "Normal",+ "settings.logDebug": "Debug",+ "settings.logEverything": "Everything","settings.light": "Light","settings.lime": "Lime","settings.lineAcrossLanesMarks": "The line across the lanes that marks the current time. Pick any colour for it, or the first dot to go back to the theme's own.",diff --git a/src/crates/concat/locales/es.json b/src/crates/concat/locales/es.jsonindex b7cf8ce8..1bf4fbdb 100644--- a/src/crates/concat/locales/es.json+++ b/src/crates/concat/locales/es.json@@ -733,6 +733,13 @@"settings.installedMbOnDisk": "{0} instalados · {1} MB en disco","settings.installerOpened": "El instalador de Concat {0} está abierto. Concat se cierra ahora para que pueda terminar.","settings.language": "Idioma",+ "settings.logLevel": "Nivel de registro",+ "settings.logLevelHint": "Qué anota el registro. Normal basta para la mayoría de los informes; Depuración o Todo cuando un informe lo pida, y el archivo crece más rápido. CONCAT_LOG en el entorno lo anula durante una ejecución.",+ "settings.logErrors": "Solo errores",+ "settings.logWarnings": "Avisos",+ "settings.logNormal": "Normal",+ "settings.logDebug": "Depuración",+ "settings.logEverything": "Todo","settings.light": "Claro","settings.lime": "Lima","settings.lineAcrossLanesMarks": "La línea que cruza las pistas y marca el tiempo actual. Elige cualquier color para ella, o el primer punto para volver al color del tema.",diff --git a/src/crates/concat/locales/fa.json b/src/crates/concat/locales/fa.jsonindex 1bc82ed9..9c5a7d31 100644--- a/src/crates/concat/locales/fa.json+++ b/src/crates/concat/locales/fa.json@@ -733,6 +733,13 @@"settings.installedMbOnDisk": "{0} نصب شده · {1} MB روی دیسک","settings.installerOpened": "نصبکنندهٔ Concat {0} باز است. Concat اکنون بسته میشود تا نصب تمام شود.","settings.language": "زبان",+ "settings.logLevel": "سطح گزارش",+ "settings.logLevelHint": "آنچه گزارش ثبت میکند. «عادی» برای بیشتر گزارشها کافی است؛ «اشکالزدایی» یا «همهچیز» وقتی گزارشی آن را بخواهد، و فایل سریعتر بزرگ میشود. CONCAT_LOG در محیط برای یک اجرا این را لغو میکند.",+ "settings.logErrors": "فقط خطاها",+ "settings.logWarnings": "هشدارها",+ "settings.logNormal": "عادی",+ "settings.logDebug": "اشکالزدایی",+ "settings.logEverything": "همهچیز","settings.light": "روشن","settings.lime": "لیمویی","settings.lineAcrossLanesMarks": "خطی که از روی ترکها میگذرد و زمان فعلی را نشان میدهد. هر رنگی را برای آن انتخاب کنید، یا نقطهٔ اول را برای بازگشت به رنگ خود تم.",diff --git a/src/crates/concat/locales/fr.json b/src/crates/concat/locales/fr.jsonindex 8a89861f..57975ffe 100644--- a/src/crates/concat/locales/fr.json+++ b/src/crates/concat/locales/fr.json@@ -733,6 +733,13 @@"settings.installedMbOnDisk": "{0} installés · {1} Mo sur le disque","settings.installerOpened": "L'installateur de Concat {0} est ouvert. Concat se ferme maintenant pour le laisser terminer.","settings.language": "Langue",+ "settings.logLevel": "Niveau de journalisation",+ "settings.logLevelHint": "Ce que le journal enregistre. Normal suffit pour la plupart des rapports ; Débogage ou Tout quand un rapport le demande, et le fichier grossit plus vite. CONCAT_LOG dans l’environnement prend le dessus pour une exécution.",+ "settings.logErrors": "Erreurs seulement",+ "settings.logWarnings": "Avertissements",+ "settings.logNormal": "Normal",+ "settings.logDebug": "Débogage",+ "settings.logEverything": "Tout","settings.light": "Clair","settings.lime": "Citron vert","settings.lineAcrossLanesMarks": "La ligne qui traverse les pistes et marque l'instant courant. Choisissez n'importe quelle couleur, ou le premier point pour revenir à celle du thème.",diff --git a/src/crates/concat/locales/hr.json b/src/crates/concat/locales/hr.jsonindex 86072d53..bac9f472 100644--- a/src/crates/concat/locales/hr.json+++ b/src/crates/concat/locales/hr.json@@ -733,6 +733,13 @@"settings.installedMbOnDisk": "{0} instalirano · {1} MB na disku","settings.installerOpened": "Instalacijski program za Concat {0} je otvoren. Concat se sada zatvara kako bi mogao završiti.","settings.language": "Jezik",+ "settings.logLevel": "Razina zapisnika",+ "settings.logLevelHint": "Što zapisnik bilježi. Normalno je dovoljno za većinu prijava; Otklanjanje grešaka ili Sve kad prijava to traži, a datoteka brže raste. CONCAT_LOG u okruženju nadjačava ovo za jedno pokretanje.",+ "settings.logErrors": "Samo greške",+ "settings.logWarnings": "Upozorenja",+ "settings.logNormal": "Normalno",+ "settings.logDebug": "Otklanjanje grešaka",+ "settings.logEverything": "Sve","settings.light": "Svijetlo","settings.lime": "Limeta","settings.lineAcrossLanesMarks": "Crta preko traka koja označava trenutno vrijeme. Odaberite bilo koju boju za nju, ili prvu točku za povratak na boju teme.",diff --git a/src/crates/concat/locales/it.json b/src/crates/concat/locales/it.jsonindex 10a1ff93..393a5ed8 100644--- a/src/crates/concat/locales/it.json+++ b/src/crates/concat/locales/it.json@@ -733,6 +733,13 @@"settings.installedMbOnDisk": "{0} installati · {1} MB su disco","settings.installerOpened": "Il programma di installazione di Concat {0} è aperto. Concat si chiude ora perché possa completarsi.","settings.language": "Lingua",+ "settings.logLevel": "Livello del log",+ "settings.logLevelHint": "Cosa registra il log. Normale basta per la maggior parte delle segnalazioni; Debug o Tutto quando una segnalazione lo chiede, e il file cresce più in fretta. CONCAT_LOG nell’ambiente lo scavalca per un’esecuzione.",+ "settings.logErrors": "Solo errori",+ "settings.logWarnings": "Avvisi",+ "settings.logNormal": "Normale",+ "settings.logDebug": "Debug",+ "settings.logEverything": "Tutto","settings.light": "Chiaro","settings.lime": "Lime","settings.lineAcrossLanesMarks": "La linea che attraversa le tracce e segna il tempo corrente. Scegli un colore qualsiasi, o il primo punto per tornare a quello del tema.",diff --git a/src/crates/concat/locales/ja.json b/src/crates/concat/locales/ja.jsonindex a2ed32bd..50e363de 100644--- a/src/crates/concat/locales/ja.json+++ b/src/crates/concat/locales/ja.json@@ -733,6 +733,13 @@"settings.installedMbOnDisk": "{0} 個インストール済み · ディスク上 {1} MB","settings.installerOpened": "Concat {0} のインストーラーが開きました。完了できるように Concat を終了します。","settings.language": "言語",+ "settings.logLevel": "ログレベル",+ "settings.logLevelHint": "ログに記録する内容。通常はほとんどの報告に十分です。報告で求められたときはデバッグかすべてにしますが、ファイルは早く大きくなります。環境変数 CONCAT_LOG は一回の起動に限りこれを上書きします。",+ "settings.logErrors": "エラーのみ",+ "settings.logWarnings": "警告",+ "settings.logNormal": "通常",+ "settings.logDebug": "デバッグ",+ "settings.logEverything": "すべて","settings.light": "ライト","settings.lime": "ライム","settings.lineAcrossLanesMarks": "トラックを横切って現在の時間を示す線です。好きな色を選ぶか、最初の点でテーマ本来の色に戻します。",diff --git a/src/crates/concat/locales/ko.json b/src/crates/concat/locales/ko.jsonindex c37fc022..808b3e4a 100644--- a/src/crates/concat/locales/ko.json+++ b/src/crates/concat/locales/ko.json@@ -733,6 +733,13 @@"settings.installedMbOnDisk": "{0}개 설치됨 · 디스크 {1} MB","settings.installerOpened": "Concat {0} 설치 프로그램이 열렸습니다. 설치를 마칠 수 있도록 Concat을 종료합니다.","settings.language": "언어",+ "settings.logLevel": "로그 수준",+ "settings.logLevelHint": "로그에 기록할 내용입니다. 대부분의 보고에는 보통이면 충분합니다. 보고에서 요청하면 디버그나 모두로 올리되, 파일이 더 빨리 커집니다. 환경 변수 CONCAT_LOG는 한 번의 실행에 한해 이 설정을 덮어씁니다.",+ "settings.logErrors": "오류만",+ "settings.logWarnings": "경고",+ "settings.logNormal": "보통",+ "settings.logDebug": "디버그",+ "settings.logEverything": "모두","settings.light": "라이트","settings.lime": "라임","settings.lineAcrossLanesMarks": "트랙을 가로질러 현재 시간을 표시하는 선입니다. 원하는 색을 고르거나, 첫 번째 점을 눌러 테마 본래의 색으로 돌아갑니다.",diff --git a/src/crates/concat/locales/pt-BR.json b/src/crates/concat/locales/pt-BR.jsonindex c22be524..40b0c7ae 100644--- a/src/crates/concat/locales/pt-BR.json+++ b/src/crates/concat/locales/pt-BR.json@@ -733,6 +733,13 @@"settings.installedMbOnDisk": "{0} instalados · {1} MB em disco","settings.installerOpened": "O instalador do Concat {0} está aberto. O Concat fecha agora para que ele possa terminar.","settings.language": "Idioma",+ "settings.logLevel": "Nível de log",+ "settings.logLevelHint": "O que o log registra. Normal basta para a maioria dos relatos; Depuração ou Tudo quando um relato pedir, e o arquivo cresce mais rápido. CONCAT_LOG no ambiente sobrepõe isto por uma execução.",+ "settings.logErrors": "Só erros",+ "settings.logWarnings": "Avisos",+ "settings.logNormal": "Normal",+ "settings.logDebug": "Depuração",+ "settings.logEverything": "Tudo","settings.light": "Claro","settings.lime": "Limão","settings.lineAcrossLanesMarks": "A linha que cruza as faixas e marca o tempo atual. Escolha qualquer cor para ela, ou o primeiro ponto para voltar à cor do tema.",diff --git a/src/crates/concat/locales/ru.json b/src/crates/concat/locales/ru.jsonindex 3bd4ae38..a6f69790 100644--- a/src/crates/concat/locales/ru.json+++ b/src/crates/concat/locales/ru.json@@ -733,6 +733,13 @@"settings.installedMbOnDisk": "Установлено: {0} · {1} МБ на диске","settings.installerOpened": "Установщик Concat {0} открыт. Concat сейчас закроется, чтобы установка могла завершиться.","settings.language": "Язык",+ "settings.logLevel": "Уровень журнала",+ "settings.logLevelHint": "Что записывает журнал. Обычного хватает для большинства отчётов; Отладка или Всё - когда об этом просят в отчёте, и файл растёт быстрее. CONCAT_LOG в окружении переопределяет это на один запуск.",+ "settings.logErrors": "Только ошибки",+ "settings.logWarnings": "Предупреждения",+ "settings.logNormal": "Обычный",+ "settings.logDebug": "Отладка",+ "settings.logEverything": "Всё","settings.light": "Светлая","settings.lime": "Лайм","settings.lineAcrossLanesMarks": "Линия поперёк дорожек, отмечающая текущее время. Выберите для неё любой цвет или первую точку, чтобы вернуть цвет темы.",diff --git a/src/crates/concat/locales/tr.json b/src/crates/concat/locales/tr.jsonindex 8290a261..8a06b920 100644--- a/src/crates/concat/locales/tr.json+++ b/src/crates/concat/locales/tr.json@@ -733,6 +733,13 @@"settings.installedMbOnDisk": "{0} kurulu · diskte {1} MB","settings.installerOpened": "Concat {0} yükleyicisi açıldı. Yüklemenin bitebilmesi için Concat şimdi kapanıyor.","settings.language": "Dil",+ "settings.logLevel": "Günlük düzeyi",+ "settings.logLevelHint": "Günlüğün neyi kaydettiği. Çoğu rapor için Normal yeter; bir rapor istediğinde Hata ayıklama ya da Her şey, dosya daha hızlı büyür. Ortamdaki CONCAT_LOG bunu bir çalıştırma için geçersiz kılar.",+ "settings.logErrors": "Yalnızca hatalar",+ "settings.logWarnings": "Uyarılar",+ "settings.logNormal": "Normal",+ "settings.logDebug": "Hata ayıklama",+ "settings.logEverything": "Her şey","settings.light": "Açık","settings.lime": "Limon yeşili","settings.lineAcrossLanesMarks": "Parçaları boydan boya geçen ve geçerli zamanı gösteren çizgi. Ona istediğiniz rengi seçin ya da temanın kendi rengine dönmek için ilk noktayı.",diff --git a/src/crates/concat/locales/zh-Hans.json b/src/crates/concat/locales/zh-Hans.jsonindex d03ffea0..10978372 100644--- a/src/crates/concat/locales/zh-Hans.json+++ b/src/crates/concat/locales/zh-Hans.json@@ -733,6 +733,13 @@"settings.installedMbOnDisk": "已安装 {0} 个 · 占用磁盘 {1} MB","settings.installerOpened": "Concat {0} 的安装程序已打开。Concat 现在将关闭,以便安装完成。","settings.language": "语言",+ "settings.logLevel": "日志级别",+ "settings.logLevelHint": "日志记录的内容。多数报告用“正常”即可;报告要求时再选“调试”或“全部”,文件会增长得更快。环境变量 CONCAT_LOG 可在单次运行中覆盖此设置。",+ "settings.logErrors": "仅错误",+ "settings.logWarnings": "警告",+ "settings.logNormal": "正常",+ "settings.logDebug": "调试",+ "settings.logEverything": "全部","settings.light": "光","settings.lime": "青柠","settings.lineAcrossLanesMarks": "横跨轨道、标记当前时间的那条线。可为它选择任意颜色,或点第一个圆点回到主题自带的颜色。",diff --git a/src/crates/concat/locales/zh-TW.json b/src/crates/concat/locales/zh-TW.jsonindex c3fde511..21983652 100644--- a/src/crates/concat/locales/zh-TW.json+++ b/src/crates/concat/locales/zh-TW.json@@ -733,6 +733,13 @@"settings.installedMbOnDisk": "已安裝 {0} 個 · 佔用磁碟 {1} MB","settings.installerOpened": "Concat {0} 的安裝程式已開啟。Concat 現在會關閉,讓安裝得以完成。","settings.language": "語言",+ "settings.logLevel": "日誌層級",+ "settings.logLevelHint": "日誌記錄的內容。多數回報用「正常」即可;回報要求時再選「偵錯」或「全部」,檔案會增長得更快。環境變數 CONCAT_LOG 可在單次執行中覆寫此設定。",+ "settings.logErrors": "僅錯誤",+ "settings.logWarnings": "警告",+ "settings.logNormal": "正常",+ "settings.logDebug": "偵錯",+ "settings.logEverything": "全部","settings.light": "光","settings.lime": "萊姆","settings.lineAcrossLanesMarks": "橫跨軌道、標記目前時間的那條線。可為它選擇任意顏色,或點第一個圓點回到主題原本的顏色。",diff --git a/src/crates/concat/src/gpu.rs b/src/crates/concat/src/gpu.rsindex 919811e0..8ec2ac0c 100644--- a/src/crates/concat/src/gpu.rs+++ b/src/crates/concat/src/gpu.rs@@ -73,11 +73,11 @@ impl Gpu {// https://github.com/jub0t/Concat/issues/135let info = adapter.get_info();log::info!(- "GPU adapter: {} ({:?}, {:?}, driver {})",+ "GPU adapter: {} ({:?}, {:?}, {})",info.name,info.device_type,info.backend,- info.driver_info+ driver_of(&info));let _ = ADAPTER.set(if info.device_type == wgpu::DeviceType::Cpu {format!("{} · {} · software rasteriser", info.name, info.backend)@@ -97,6 +97,12 @@ impl Gpu {..Default::default()})).ok()?;+ // Said in the log when it dies, with wgpu's reason: the one line a+ // report of "the GPU device was lost" needs, which until now there+ // was none of. https://github.com/jub0t/Concat/issues/223+ device.set_device_lost_callback(|reason, message| {+ log::error!("the window's GPU device was lost ({reason:?}): {message}");+ });Some(Gpu {instance,adapter,@@ -122,3 +128,20 @@ impl Gpu {}}}++/// The adapter's driver as the log names it: the driver and its version+/// where the API reports them, and "driver unknown" where it does not -+/// Direct3D 12 reports neither, and an empty "driver )" read as a fault.+/// https://github.com/jub0t/Concat/issues/223+pub fn driver_of(info: &wgpu::AdapterInfo) -> String {+ let named = [info.driver.trim(), info.driver_info.trim()]+ .into_iter()+ .filter(|part| !part.is_empty())+ .collect::<Vec<_>>()+ .join(" ");+ if named.is_empty() {+ "driver unknown".to_owned()+ } else {+ format!("driver {named}")+ }+}diff --git a/src/crates/concat/src/lib.rs b/src/crates/concat/src/lib.rsindex d18adfd6..18ec0747 100644--- a/src/crates/concat/src/lib.rs+++ b/src/crates/concat/src/lib.rs@@ -1406,6 +1406,9 @@ pub fn run() -> Result<(), slint::PlatformError> {app.on_settings_language_changed(on_window!(|state, index: i32| {state.handle(Msg::Settings(SettingsMsg::LanguageChanged(index)));}));+ app.on_settings_log_level_changed(on_window!(|state, index: i32| {+ state.handle(Msg::Settings(SettingsMsg::LogLevelChanged(index)));+ }));app.on_settings_playhead_stops_changed(on_window!(|state, on: bool| {state.handle(Msg::Settings(SettingsMsg::PlayheadStopsChanged(on)));}));diff --git a/src/crates/concat/src/panes/settings.rs b/src/crates/concat/src/panes/settings.rsindex a40b8f49..0a9d4ad4 100644--- a/src/crates/concat/src/panes/settings.rs+++ b/src/crates/concat/src/panes/settings.rs@@ -40,6 +40,8 @@ pub enum SettingsMsg {/// Show this run's log in the file manager.ShowLog,LanguageChanged(i32),+ /// The log level's row: an index into [`LOG_LEVELS`].+ LogLevelChanged(i32),PlayheadStopsChanged(bool),/// The magnetic timeline switch; the tray's button is the same fact.MagneticChanged(bool),@@ -250,6 +252,16 @@ impl SettingsPane {}studio.prefs.save(&studio.host.dirs);}+ SettingsMsg::LogLevelChanged(index) => {+ let Some(level) = LOG_LEVELS.get(index.max(0) as usize) else {+ return;+ };+ studio.prefs.log_level = Some(concat_host::logs::level_name(*level).to_owned());+ studio.prefs.save(&studio.host.dirs);+ // Applied now, whatever the environment said: a person at+ // the sheet is asking for this run too.+ concat_host::logs::set_level(*level);+ }SettingsMsg::PlayheadStopsChanged(on) => {self.playhead_stops = on;studio.prefs.playhead_stops_at_end = on;@@ -740,6 +752,10 @@ impl SettingsPane {open: self.open,tab: self.tab,language: self.language as i32,+ log_level: LOG_LEVELS+ .iter()+ .position(|level| *level == log::max_level())+ .unwrap_or(2) as i32,playhead_stops: self.playhead_stops,magnetic: studio.prefs.magnetic,download_source: self.download_source as i32,@@ -826,6 +842,17 @@ fn quit_for_switch() {/// A fresh token: 128 bits from the OS's randomness, as the standard/// library hands it out through its hasher's seed, spelled in hex.+/// The log level row's choices, in the order the sheet lists them:+/// errors only, warnings, normal, debug, everything.+/// https://github.com/jub0t/Concat/issues/223+const LOG_LEVELS: [log::LevelFilter; 5] = [+ log::LevelFilter::Error,+ log::LevelFilter::Warn,+ log::LevelFilter::Info,+ log::LevelFilter::Debug,+ log::LevelFilter::Trace,+];+pub fn new_token() -> String {use std::hash::{BuildHasher, Hasher};let word = |salt: u64| {diff --git a/src/crates/concat/src/prefs.rs b/src/crates/concat/src/prefs.rsindex f50334d7..3bdf04d4 100644--- a/src/crates/concat/src/prefs.rs+++ b/src/crates/concat/src/prefs.rs@@ -72,6 +72,10 @@ pub struct Preferences {/// kept from a title by the Text panel's "Use for new titles"; its/// words are empty. None starts titles in the bundled face.pub title_style: Option<concat_project::model::TextStyle>,+ /// What the log records, by the name concat_host::logs reads: `info`+ /// unless the Settings sheet was asked for more or less. CONCAT_LOG in+ /// the environment overrides it for one run.+ pub log_level: Option<String>,}impl Preferences {diff --git a/src/crates/concat/src/studio.rs b/src/crates/concat/src/studio.rsindex abe7c3a3..b44cfed6 100644--- a/src/crates/concat/src/studio.rs+++ b/src/crates/concat/src/studio.rs@@ -1842,6 +1842,17 @@ impl Studio {/// read off disk.pub fn new(host: Host) -> Self {let prefs = Preferences::load(&host.dirs);+ // The remembered log level, unless this run's environment named+ // one: CONCAT_LOG is the louder ask.+ if concat_host::logs::environment_level().is_none()+ && let Some(level) = prefs+ .log_level+ .as_deref()+ .and_then(concat_host::logs::level_named)+ && level != log::max_level()+ {+ concat_host::logs::set_level(level);+ }// The words first, so everything published from here on is in// the remembered language.i18n::select(prefs.locale.as_deref().unwrap_or(i18n::ENGLISH), &host.dirs);diff --git a/src/crates/concat/ui/app.slint b/src/crates/concat/ui/app.slintindex e36f3d82..b52c4d4e 100644--- a/src/crates/concat/ui/app.slint+++ b/src/crates/concat/ui/app.slint@@ -239,6 +239,7 @@ export component App inherits Window {callback settings-page-changed(index: int);callback settings-show-log();callback settings-language-changed(index: int);+ callback settings-log-level-changed(index: int);callback settings-theme-changed(dark: bool);callback settings-accent-changed(index: int);callback settings-accent-custom-changed(colour: color);@@ -739,6 +740,7 @@ export component App inherits Window {page-changed(index) => { root.settings-page-changed(index); }show-log => { root.settings-show-log(); }language-changed(index) => { root.settings-language-changed(index); }+ log-level-changed(index) => { root.settings-log-level-changed(index); }theme-changed(dark) => { root.settings-theme-changed(dark); }accent-changed(index) => { root.settings-accent-changed(index); }accent-custom-changed(colour) => { root.settings-accent-custom-changed(colour); }diff --git a/src/crates/concat/ui/dialogs/settings.slint b/src/crates/concat/ui/dialogs/settings.slintindex d52dca86..6635740f 100644--- a/src/crates/concat/ui/dialogs/settings.slint+++ b/src/crates/concat/ui/dialogs/settings.slint@@ -52,6 +52,9 @@ export struct SettingsData {/// 6 Versiontab: int,language: int,+ /// what the log records: 0 errors only, 1 warnings, 2 normal, 3+ /// debug, 4 everything+ log-level: int,/// the playhead stops at the end of the contentplayhead-stops: bool,/// the magnetic timeline: deleting and trimming close the gap@@ -429,6 +432,7 @@ export component SettingsDialog inherits Modal {/// Opens the folder this run's log is being written into.callback show-log();callback language-changed(index: int);+ callback log-level-changed(index: int);/// The theme, chosen rather than flipped. A toggle in the strip could only/// say "the other one"; a page with two named options can say which one is/// on, which is the whole reason it moved in here.@@ -647,6 +651,28 @@ export component SettingsDialog inherits Modal {}}+ // What the log records. Normal is what a bug report needs+ // most days; Debug and Everything are for when a report+ // asks, and the file grows faster for them. CONCAT_LOG in+ // the environment overrides this for one run.+ // https://github.com/jub0t/Concat/issues/223+ DialogSection {+ title: I18n.t("settings.logLevel");+ hint: I18n.t("settings.logLevelHint");++ Select {+ options: [+ I18n.t("settings.logErrors"),+ I18n.t("settings.logWarnings"),+ I18n.t("settings.logNormal"),+ I18n.t("settings.logDebug"),+ I18n.t("settings.logEverything"),+ ];+ current: root.data.log-level;+ changed(index) => { root.log-level-changed(index); }+ }+ }+// Off, a delete leaves its hole and a trim moves one edge.// On, the lane closes up behind either - the magnetic// timeline of the mainstream editors, asked for in