Exemplo n.º 1
0
 internal TelegramLogger(
     string category,
     TelegramLoggerSender messageQueue,
     TelegramLoggerOptions options,
     Func <string, LogLevel, bool> filter)
 {
     _category     = category ?? throw new ArgumentNullException(nameof(category));
     _messageQueue = messageQueue;
     _filter       = filter ?? ((cat, logLevel) => true);
     _options      = options;
 }
Exemplo n.º 2
0
        public TelegramLoggerProvider(
            ITelegramBotClient botClient,
            TelegramLoggerOptions options,
            Func <string, LogLevel, bool> filter)
        {
            if (string.IsNullOrEmpty(options.ChatId) || string.IsNullOrWhiteSpace(options.ChatId))
            {
                throw new ArgumentException("Log receiver Id should not be null, empty or be a whitespace");
            }

            if (string.IsNullOrEmpty(options.SourceName) || string.IsNullOrWhiteSpace(options.SourceName))
            {
                throw new ArgumentException("Source name should not be null, empty or be a whitespace");
            }

            _filter       = filter;
            _options      = options;
            _messageQueue = new TelegramLoggerSender(botClient, options.ChatId);
        }