WIP 847, solve 1008, solve 1010 by adamralph · Pull Request #1009 · scriptcs/scriptcs · GitHub
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

Large diffs are not rendered by default.

97 changes: 97 additions & 0 deletions src/ScriptCs.Contracts/DefaultLogProvider.cs
36 changes: 36 additions & 0 deletions src/ScriptCs.Contracts/ILog.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
namespace ScriptCs.Contracts
{
using System;

public interface ILog
{
/// <summary>
/// Logs a message for a specified log level, if the <see cref="ILog"/> is enabled for that log level.
/// </summary>
/// <param name="logLevel">The log level.</param>
/// <param name="createMessage">
/// Optional function which creates the message.
/// Specify <c>null</c> to simply check if the logger is enabled for the <paramref name="logLevel"/>.
/// </param>
/// <param name="exception">An optional exception to include with the message.</param>
/// <param name="formatArgs">
/// Optional arguments for formatting the message created by <paramref name="createMessage"/>.
/// </param>
/// <returns>
/// <c>true</c> if the <see cref="ILog"/> is enabled for the <paramref name="logLevel"/>.
/// Otherwise <c>false</c>.
/// </returns>
/// <remarks>
/// Note to implementers for optimal performance:
/// When the <paramref name="createMessage"/> is <c>null</c>, simply return a <see cref="bool"/>
/// indicating whether the <see cref="ILog"/> is enabled for the specified <paramref name="logLevel"/>.
/// When the <paramref name="createMessage"/> is not <c>null</c>, it should only be invoked
/// if the <see cref="ILog"/> is enabled for the specified <paramref name="logLevel"/>.
/// </remarks>
bool Log(
LogLevel logLevel,
Func<string> createMessage = null,
Exception exception = null,
params object[] formatArgs);
}
}
21 changes: 21 additions & 0 deletions src/ScriptCs.Contracts/ILogProvider.cs
Loading