Strato browser (M0/M2): client CDP con elenco dei comandi ammessi, ChromiumProcessHost e Xvfb sorvegliati, gesti umani, mappa dei bersagli, cattura delle risposte, segnali di arresto, scaricamento dal browser, vista remota, distribuzioni del ritmo; prove unitarie e d'insieme con Chromium su Xvfb; esito locale di S5 e S6
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mzbb6zeFTjT6Rp8b92AVkA
This commit is contained in:
44 files changed
+8396
No files matched your search
@@ -0,0 +1,48 @@
|
||||
namespace Febe.Browser.Diagnostics;
|
||||
|
||||
public enum BrowserLogLevel
|
||||
{
|
||||
Debug,
|
||||
Information,
|
||||
Warning,
|
||||
Error,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Log sink of the browser layer. The host application adapts it to its own logging.
|
||||
/// Messages never contain parameters or results of CDP commands, cookies, keystrokes, bodies or CDN addresses
|
||||
/// (spec §2 rule 11, §13.2): only command and event names, states and counts.
|
||||
/// </summary>
|
||||
public interface IBrowserLog
|
||||
{
|
||||
void Write(BrowserLogLevel level, string message, Exception? exception = null);
|
||||
}
|
||||
|
||||
/// <summary>Discards everything.</summary>
|
||||
public sealed class NullBrowserLog : IBrowserLog
|
||||
{
|
||||
public static NullBrowserLog Instance { get; } = new();
|
||||
|
||||
public void Write(BrowserLogLevel level, string message, Exception? exception = null)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Forwards to a delegate (handy for tests and console tools).</summary>
|
||||
public sealed class DelegateBrowserLog(Action<BrowserLogLevel, string, Exception?> write) : IBrowserLog
|
||||
{
|
||||
public void Write(BrowserLogLevel level, string message, Exception? exception = null) => write(level, message, exception);
|
||||
}
|
||||
|
||||
internal static class BrowserLogExtensions
|
||||
{
|
||||
public static void Debug(this IBrowserLog log, string message) => log.Write(BrowserLogLevel.Debug, message);
|
||||
|
||||
public static void Info(this IBrowserLog log, string message) => log.Write(BrowserLogLevel.Information, message);
|
||||
|
||||
public static void Warn(this IBrowserLog log, string message, Exception? exception = null) =>
|
||||
log.Write(BrowserLogLevel.Warning, message, exception);
|
||||
|
||||
public static void Error(this IBrowserLog log, string message, Exception? exception = null) =>
|
||||
log.Write(BrowserLogLevel.Error, message, exception);
|
||||
}
|
||||
Reference in new issue
Block a user