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
3 changes: 2 additions & 1 deletion src/ILogMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace WB.Logging;
/// A log message.
/// </summary>
public interface ILogMessage<out TPayload>
where TPayload : notnull
{
// ┌─────────────────────────────────────────────────────────────────────────────┐
// │ Public Properties │
Expand All @@ -31,5 +32,5 @@ public interface ILogMessage<out TPayload>
/// <summary>
/// Gets the payload of the log message.
/// </summary>
public TPayload? Payload { get; }
public TPayload Payload { get; }
}
3 changes: 2 additions & 1 deletion src/ILogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ public interface ILogger : IAsyncDisposable
/// </summary>
/// <param name="logLevel">The <see cref="LogLevel"/>.</param>
/// <param name="payload">The payload to log.</param>
public void Log<TPayload>(LogLevel? logLevel, TPayload payload);
public void Log<TPayload>(LogLevel? logLevel, TPayload payload)
where TPayload : notnull;

/// <summary>
/// Flushes all pending log messages.
Expand Down
3 changes: 3 additions & 0 deletions src/ILoggerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public void Exception(Exception exception)
/// <param name="payload">The payload to log.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Info<TPayload>(TPayload payload)
where TPayload : notnull
=> @this.Log(LogLevel.Info, payload);

/// <summary>
Expand All @@ -38,6 +39,7 @@ public void Info<TPayload>(TPayload payload)
/// <param name="payload">The payload to log.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Warning<TPayload>(TPayload payload)
where TPayload : notnull
=> @this.Log(LogLevel.Warning, payload);

/// <summary>
Expand All @@ -47,6 +49,7 @@ public void Warning<TPayload>(TPayload payload)
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1716:Identifiers should not match keywords", Justification = "Common logging term.")]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Error<TPayload>(TPayload payload)
where TPayload : notnull
=> @this.Log(LogLevel.Error, payload);
}
}
3 changes: 2 additions & 1 deletion src/LogSinks/IAsyncLogSink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ public interface IAsyncLogSink
/// <param name="logMessage">The <see cref="ILogMessage{TPayload}"/> to submit.</param>
/// <typeparam name="TPayload">The type of the payload of the log message.</typeparam>
/// <returns>A <see cref="ValueTask"/> that represents the asynchronous operation of submitting the log message.</returns>
public ValueTask SubmitAsync<TPayload>(ILogMessage<TPayload> logMessage);
public ValueTask SubmitAsync<TPayload>(ILogMessage<TPayload> logMessage)
where TPayload : notnull;
}
3 changes: 2 additions & 1 deletion src/LogSinks/ILogSink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ public interface ILogSink
/// </summary>
/// <param name="logMessage">The <see cref="ILogMessage{TPayload}"/> to submit.</param>
/// <typeparam name="TPayload">The type of the payload of the log message.</typeparam>
public void Submit<TPayload>(ILogMessage<TPayload> logMessage);
public void Submit<TPayload>(ILogMessage<TPayload> logMessage)
where TPayload : notnull;
}
1 change: 1 addition & 0 deletions src/LogSinks/ILogSink{TPayload}.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace WB.Logging;
/// </summary>
/// <typeparam name="TPayload">The type of the payload of the log messages that this log sink can process.</typeparam>
public interface ILogSink<TPayload>
where TPayload : notnull
{
// ┌─────────────────────────────────────────────────────────────────────────────┐
// │ Public Methods │
Expand Down
Loading