Files
BotPages/BotPages.Core/Pipeline/LoggingMiddleware.cs

17 lines
670 B
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
namespace BotPages.Core
{
/// <summary>
/// Middleware логирования входящих обновлений.
/// </summary>
public sealed class LoggingMiddleware : IUpdateMiddleware
{
/// <summary>
/// Логирует базовую информацию об обновлении и вызывает следующий этап.
/// </summary>
public async Task InvokeAsync(UpdateContext ctx, Func<Task> next, CancellationToken ct)
{
Console.WriteLine($"[{DateTime.UtcNow:O}] Update: chat={ctx.Chat.Id}, user={ctx.User.Id}, text={ctx.Text}");
await next();
}
}
}