-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
34b9b40
commit cec3811
Showing
7 changed files
with
266 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,85 @@ | ||
// <copyright file="ILogContext.cs" company="WebDriver 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> | ||
|
||
using System; | ||
|
||
namespace OpenQA.Selenium.Internal.Logging | ||
{ | ||
/// <summary> | ||
/// Represents a logging context that provides methods for creating sub-contexts, retrieving loggers, emitting log messages, and configuring minimum log levels. | ||
/// </summary> | ||
public interface ILogContext : IDisposable | ||
{ | ||
/// <summary> | ||
/// Creates a new logging context. | ||
/// </summary> | ||
/// <returns>A new instance of <see cref="ILogContext"/>.</returns> | ||
ILogContext CreateContext(); | ||
|
||
/// <summary> | ||
/// Creates a new logging context with the specified minimum log level. | ||
/// </summary> | ||
/// <param name="minimumLevel">The minimum log level for the new context.</param> | ||
/// <returns>A new instance of <see cref="ILogContext"/> with the specified minimum log level.</returns> | ||
ILogContext CreateContext(LogEventLevel minimumLevel); | ||
|
||
/// <summary> | ||
/// Gets a logger for the specified type. | ||
/// </summary> | ||
/// <typeparam name="T">The type for which to retrieve the logger.</typeparam> | ||
/// <returns>An instance of <see cref="ILogger"/> for the specified type.</returns> | ||
ILogger GetLogger<T>(); | ||
|
||
/// <summary> | ||
/// Gets a logger for the specified type. | ||
/// </summary> | ||
/// <param name="type">The type for which to retrieve the logger.</param> | ||
/// <returns>An instance of <see cref="ILogger"/> for the specified type.</returns> | ||
ILogger GetLogger(Type type); | ||
|
||
/// <summary> | ||
/// Emits a log message using the specified logger, log level, and message. | ||
/// </summary> | ||
/// <param name="logger">The logger to emit the log message.</param> | ||
/// <param name="level">The log level of the message.</param> | ||
/// <param name="message">The log message.</param> | ||
void EmitMessage(ILogger logger, LogEventLevel level, string message); | ||
|
||
/// <summary> | ||
/// Sets the minimum log level for the current context. | ||
/// </summary> | ||
/// <param name="level">The minimum log level.</param> | ||
/// <returns>The current instance of <see cref="ILogContext"/> with the minimum log level set.</returns> | ||
ILogContext SetMinimumLevel(LogEventLevel level); | ||
|
||
/// <summary> | ||
/// Sets the minimum log level for the specified type in the current context. | ||
/// </summary> | ||
/// <param name="issuer">The type for which to set the minimum log level.</param> | ||
/// <param name="level">The minimum log level.</param> | ||
/// <returns>The current instance of <see cref="ILogContext"/> with the minimum log level set for the specified type.</returns> | ||
ILogContext SetMinimumLevel(Type issuer, LogEventLevel level); | ||
|
||
/// <summary> | ||
/// Adds a log handler to the current context. | ||
/// </summary> | ||
/// <param name="handler">The log handler to add.</param> | ||
/// <returns>The current instance of <see cref="ILogContext"/> with the log handler added.</returns> | ||
ILogContext WithHandler(ILogHandler handler); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,38 @@ | ||
using System; | ||
// <copyright file="ILogHandler.cs" company="WebDriver 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.Internal.Logging | ||
{ | ||
/// <summary> | ||
/// Represents a log handler that handles log events. | ||
/// </summary> | ||
public interface ILogHandler | ||
{ | ||
/// <summary> | ||
/// Handles a log event. | ||
/// </summary> | ||
/// <param name="logEvent">The log event to handle.</param> | ||
void Handle(LogEvent logEvent); | ||
|
||
/// <summary> | ||
/// Creates a clone of the log handler. | ||
/// </summary> | ||
/// <returns>A clone of the log handler.</returns> | ||
ILogHandler Clone(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.