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 -
Method Summary
Modifier and TypeMethodDescriptionch.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.
-
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 clienttemplateEngine
- the template engine for formatting messagestelegramProperties
- properties containing the admin IDlayout
- the layout for formatting log messagesloggerContext
- the logger contextfilter
- 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 messagesloggerContext
- 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 thresholdloggerContext
- the logger context- Returns:
- the configured filter
-