本文最后更新于 2024-08-27T14:59:49+00:00
CefSharp禁用debug.log
由于 CefSharp 默认会记录日志到debug.log
文件中,如果不做清理或限制这个文件甚至会高达上百兆。
以下是解决方案:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| public static void Init() { var settings = new CefSettings(); settings.LogSeverity = LogSeverity.Disable; settings.CachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "CefSharp\\Cache"); settings.CefCommandLineArgs.Add("enable-media-stream"); settings.CefCommandLineArgs.Add("disable-gpu"); settings.CefCommandLineArgs.Add("no-proxy-server");
Cef.Initialize(settings); }
|
大部分代码与题无关,关键是settings.LogSeverity = LogSeverity.Disable;
。