Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ internal class LogEntryConverter : JsonConverter<Modules.Log.LogEntry>
{
"console" => JsonSerializer.Deserialize(ref reader, options.GetTypeInfo<ConsoleLogEntry>()),
"javascript" => JsonSerializer.Deserialize(ref reader, options.GetTypeInfo<JavascriptLogEntry>()),
_ => null,
_ => JsonSerializer.Deserialize(ref reader, options.GetTypeInfo<GenericLogEntry>()),
};
}

Expand Down
4 changes: 4 additions & 0 deletions dotnet/src/webdriver/BiDi/Modules/Log/LogEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ namespace OpenQA.Selenium.BiDi.Modules.Log;

// https://github.com/dotnet/runtime/issues/72604
//[JsonPolymorphic(TypeDiscriminatorPropertyName = "type")]
//[JsonDerivedType(typeof(GenericLogEntry))] // Fallback when discriminator is not recognized, we have to double check
//[JsonDerivedType(typeof(ConsoleLogEntry), "console")]
//[JsonDerivedType(typeof(JavascriptLogEntry), "javascript")]
public abstract record LogEntry(BiDi BiDi, Level Level, Script.Source Source, string Text, DateTimeOffset Timestamp)
Expand All @@ -32,6 +33,9 @@ public abstract record LogEntry(BiDi BiDi, Level Level, Script.Source Source, st
public Script.StackTrace? StackTrace { get; set; }
}

public record GenericLogEntry(BiDi BiDi, string Type, Level Level, Script.Source Source, string Text, DateTimeOffset Timestamp)
: LogEntry(BiDi, Level, Source, Text, Timestamp);

public record ConsoleLogEntry(BiDi BiDi, Level Level, Script.Source Source, string Text, DateTimeOffset Timestamp, string Method, IReadOnlyList<Script.RemoteValue> Args)
: LogEntry(BiDi, Level, Source, Text, Timestamp);

Expand Down
Loading