* Added new handler type "InlineQueryHandler"
* Acts as complex multi-type handler that supports InlineQuery AND ChosenInlineQuery updates * Added "UpdateTypeExtensions.SuppressTypes" to suppress some of update types for multi-type handlers * Logging adjustments * Changed extension method "HasPublicProperties" to extned Type
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Telegrator.Logging;
|
||||
|
||||
namespace Telegrator.Hosting.Logging
|
||||
@@ -8,27 +9,27 @@ namespace Telegrator.Hosting.Logging
|
||||
/// </summary>
|
||||
public class MicrosoftLoggingAdapter : ITelegratorLogger
|
||||
{
|
||||
private readonly Microsoft.Extensions.Logging.ILogger _logger;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of MicrosoftLoggingAdapter.
|
||||
/// </summary>
|
||||
/// <param name="logger">The Microsoft.Extensions.Logging logger instance.</param>
|
||||
public MicrosoftLoggingAdapter(Microsoft.Extensions.Logging.ILogger logger)
|
||||
public MicrosoftLoggingAdapter(ILogger logger)
|
||||
{
|
||||
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Log(LogLevel level, string message, Exception? exception = null)
|
||||
public void Log(Telegrator.Logging.LogLevel level, string message, Exception? exception = null)
|
||||
{
|
||||
var msLogLevel = level switch
|
||||
{
|
||||
LogLevel.Trace => Microsoft.Extensions.Logging.LogLevel.Trace,
|
||||
LogLevel.Debug => Microsoft.Extensions.Logging.LogLevel.Debug,
|
||||
LogLevel.Information => Microsoft.Extensions.Logging.LogLevel.Information,
|
||||
LogLevel.Warning => Microsoft.Extensions.Logging.LogLevel.Warning,
|
||||
LogLevel.Error => Microsoft.Extensions.Logging.LogLevel.Error,
|
||||
Telegrator.Logging.LogLevel.Trace => Microsoft.Extensions.Logging.LogLevel.Trace,
|
||||
Telegrator.Logging.LogLevel.Debug => Microsoft.Extensions.Logging.LogLevel.Debug,
|
||||
Telegrator.Logging.LogLevel.Information => Microsoft.Extensions.Logging.LogLevel.Information,
|
||||
Telegrator.Logging.LogLevel.Warning => Microsoft.Extensions.Logging.LogLevel.Warning,
|
||||
Telegrator.Logging.LogLevel.Error => Microsoft.Extensions.Logging.LogLevel.Error,
|
||||
_ => Microsoft.Extensions.Logging.LogLevel.Information
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
@@ -50,7 +49,6 @@ namespace Telegrator.Hosting
|
||||
services.AddSingleton<IAwaitingProvider, HostAwaitingProvider>();
|
||||
services.AddSingleton<IHandlersProvider, HostHandlersProvider>();
|
||||
services.AddSingleton<IUpdateRouter, HostUpdateRouter>();
|
||||
//services.AddSingleton<ITelegramBotInfo, TelegramBotInfo>(services => new TelegramBotInfo(services.GetRequiredService<ITelegramBotClient>().GetMe().Result));
|
||||
services.AddSingleton<ITelegramBotInfo, HostedTelegramBotInfo>();
|
||||
|
||||
return services;
|
||||
|
||||
Reference in New Issue
Block a user