ConsoleMessage Class

A message printed by the console namespace of a window (the Printer operation of the Console Standard, https://console.spec.whatwg.org/#printer), given to BrowsingContextOptions.ConsoleMessage.

public sealed class ConsoleMessage

Constructors

NameDescription
ConsoleMessage(string, ConsoleMessageLevel, string)Creates a console message.

ConsoleMessage(string, ConsoleMessageLevel, string)

ConsoleMessage.cs

Creates a console message.

public ConsoleMessage(string method, ConsoleMessageLevel level, string text)

Parameters

method string
The name of the console method that printed the message (e.g. log, count, timeEnd).
level ConsoleMessageLevel
The severity of the message.
text string
The text of the message.

Properties

NameDescription
ArgumentsGets the arguments of the message, before formatting, converted as the IDL type any: the strings are .NET strings, the platform objects are their .NET objects, undefined is null, and the other values are values of the script engine.
GroupDepthGets the number of groups (console.group()) the message is in.
LevelGets the severity of the message.
LocationGets the location of the code that printed the message (the source file, line and column of the innermost running script), or null when the script engine cannot extract it.
MethodGets the name of the console method that printed the message (the log level of the Console Standard): log, info, warn, error, debug, assert, count, countReset, time, timeLog, timeEnd, group, groupCollapsed, trace, table, dir, dirxml or clear.
StackTraceGets the call stack of a console.trace() message, or null.
TextGets the text of the message: the arguments formatted by the formatter of the Console Standard (https://console.spec.whatwg.org/#formatter), and the values that are not strings formatted as a browser console does. It is not indented by the groups (see ConsoleMessage.GroupDepth).

Gets the arguments of the message, before formatting, converted as the IDL type any: the strings are .NET strings, the platform objects are their .NET objects, undefined is null, and the other values are values of the script engine.

public IReadOnlyList<object?> Arguments { get; init; }

Gets the number of groups (console.group()) the message is in.

public int GroupDepth { get; init; }

Property value

int

Gets the severity of the message.

public ConsoleMessageLevel Level { get; }

Property value

ConsoleMessageLevel

Gets the location of the code that printed the message (the source file, line and column of the innermost running script), or null when the script engine cannot extract it.

public ScriptLocation? Location { get; init; }

Property value

ScriptLocation?

Gets the name of the console method that printed the message (the log level of the Console Standard): log, info, warn, error, debug, assert, count, countReset, time, timeLog, timeEnd, group, groupCollapsed, trace, table, dir, dirxml or clear.

public string Method { get; }

Property value

string

Gets the call stack of a console.trace() message, or null.

public string? StackTrace { get; init; }

Property value

string?

Gets the text of the message: the arguments formatted by the formatter of the Console Standard (https://console.spec.whatwg.org/#formatter), and the values that are not strings formatted as a browser console does. It is not indented by the groups (see ConsoleMessage.GroupDepth).

public string Text { get; }

Property value

string

Methods

NameDescription
ToString()Returns a string that represents the current object.

Returns a string that represents the current object.

public override string ToString()

Returns

string A string that represents the current object.