Class TelegramBotAppenderConfiguration

java.lang.Object
io.github.yvasyliev.telegramforwarderbot.configuration.TelegramBotAppenderConfiguration

@Configuration @ConditionalOnProperty(name="logging.telegram-bot-appender.enabled", havingValue="true", matchIfMissing=true) public class TelegramBotAppenderConfiguration extends Object
Configuration for the Telegram Bot Appender that sends log messages to a Telegram chat. The appender is enabled by default and can be disabled by setting logging.telegram-bot-appender.enabled=false property.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    ch.qos.logback.core.filter.Filter<ch.qos.logback.classic.spi.ILoggingEvent>
    filter(TelegramBotAppenderProperties properties, ch.qos.logback.classic.LoggerContext loggerContext)
    Creates a filter for the Telegram Bot Appender that filters log events based on the specified level.
    ch.qos.logback.core.Layout<ch.qos.logback.classic.spi.ILoggingEvent>
    layout(TelegramBotAppenderProperties properties, ch.qos.logback.classic.LoggerContext loggerContext)
    Creates a layout for formatting log messages sent to the Telegram Bot Appender.
    ch.qos.logback.classic.LoggerContext
    Provides the logger context for the Telegram Bot Appender.
    ch.qos.logback.core.Appender<ch.qos.logback.classic.spi.ILoggingEvent>
    telegramBotAppender(org.telegram.telegrambots.meta.generics.TelegramClient telegramClient, TelegramTemplateEngine templateEngine, TelegramProperties telegramProperties, ch.qos.logback.core.Layout<ch.qos.logback.classic.spi.ILoggingEvent> layout, ch.qos.logback.classic.LoggerContext loggerContext, ch.qos.logback.core.filter.Filter<ch.qos.logback.classic.spi.ILoggingEvent> filter)
    Creates a Telegram Bot Appender bean that sends log messages to a Telegram chat.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TelegramBotAppenderConfiguration

      public TelegramBotAppenderConfiguration()
  • Method Details

    • telegramBotAppender

      @Bean(initMethod="start") public ch.qos.logback.core.Appender<ch.qos.logback.classic.spi.ILoggingEvent> telegramBotAppender(org.telegram.telegrambots.meta.generics.TelegramClient telegramClient, TelegramTemplateEngine templateEngine, TelegramProperties telegramProperties, ch.qos.logback.core.Layout<ch.qos.logback.classic.spi.ILoggingEvent> layout, ch.qos.logback.classic.LoggerContext loggerContext, ch.qos.logback.core.filter.Filter<ch.qos.logback.classic.spi.ILoggingEvent> filter)
      Creates a Telegram Bot Appender bean that sends log messages to a Telegram chat.
      Parameters:
      telegramClient - the Telegram client
      templateEngine - the template engine for formatting messages
      telegramProperties - properties containing the admin ID
      layout - the layout for formatting log messages
      loggerContext - the logger context
      filter - the filter for log events
      Returns:
      the configured Telegram Bot Appender
    • layout

      @Bean(initMethod="start") public ch.qos.logback.core.Layout<ch.qos.logback.classic.spi.ILoggingEvent> layout(TelegramBotAppenderProperties properties, ch.qos.logback.classic.LoggerContext loggerContext)
      Creates a layout for formatting log messages sent to the Telegram Bot Appender.
      Parameters:
      properties - the properties containing the pattern for log messages
      loggerContext - the logger context
      Returns:
      the configured layout
    • loggerContext

      @Bean public ch.qos.logback.classic.LoggerContext loggerContext()
      Provides the logger context for the Telegram Bot Appender.
      Returns:
      the logger context
    • filter

      @Bean(initMethod="start") public ch.qos.logback.core.filter.Filter<ch.qos.logback.classic.spi.ILoggingEvent> filter(TelegramBotAppenderProperties properties, ch.qos.logback.classic.LoggerContext loggerContext)
      Creates a filter for the Telegram Bot Appender that filters log events based on the specified level.
      Parameters:
      properties - the properties containing the log level threshold
      loggerContext - the logger context
      Returns:
      the configured filter