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
61 changes: 61 additions & 0 deletions dotnet/src/webdriver/Chromium/ChromiumDriverLogLevel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// <copyright file="ChromiumDriverLogLevel.cs" company="Selenium Committers">
// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The SFC licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
// </copyright>

namespace OpenQA.Selenium.Chromium;

/// <summary>
/// Represents the valid values of logging levels available with the Chromium based drivers.
/// </summary>
public enum ChromiumDriverLogLevel
{
/// <summary>
/// Represents the value All, the most detailed logging level available.
/// </summary>
All,

/// <summary>
/// Represents the Debug value
/// </summary>
Debug,

/// <summary>
/// Represents the Info value
/// </summary>
Info,

/// <summary>
/// Represents the Warning value
/// </summary>
Warning ,

/// <summary>
/// Represents the Severe value
/// </summary>
Severe,

/// <summary>
/// Represents the Off value, nothing gets logged
/// </summary>
Off,

/// <summary>
/// Represents that the logging value is unspecified, and should be the default level.
/// </summary>
Default
}
14 changes: 14 additions & 0 deletions dotnet/src/webdriver/Chromium/ChromiumDriverService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ protected ChromiumDriverService(string? executablePath, string? executableFileNa
/// </summary>
public bool EnableAppendLog { get; set; }

/// <summary>
/// Gets or sets the level at which log output is displayed.
/// </summary>
public ChromiumDriverLogLevel LogLevel { get; set; } = ChromiumDriverLogLevel.Default;

/// <summary>
/// <para>Gets or sets the comma-delimited list of IP addresses that are approved to connect to this instance of the Chrome driver.</para>
/// <para>A value of <see langword="null"/> or <see cref="string.Empty"/> means only the local loopback address can connect.</para>
Expand Down Expand Up @@ -154,6 +159,15 @@ protected override string CommandLineArguments
argsBuilder.Append(string.Format(CultureInfo.InvariantCulture, " -allowed-ips={0}", this.AllowedIPAddresses));
}

if (this.LogLevel != ChromiumDriverLogLevel.Default)
{
if (Enum.IsDefined(typeof(ChromiumDriverLogLevel), this.LogLevel))
{
argsBuilder.Append(string.Format(CultureInfo.InvariantCulture, " --log-level={0}", this.LogLevel.ToString().ToUpperInvariant()));
}
}


return argsBuilder.ToString();
}
}
Expand Down