Documentation
¶
Overview ¶
Package tglogger provides real-time logging capabilities to Telegram chats/channels. It implements Go's standard log.Writer interface for seamless integration with existing logging workflows.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitializeTgLogger ¶
InitializeTgLogger creates and configures a new TelegramLogger instance. It validates the configuration, sets up the logger, and verifies the bot token. After successful initialization, it becomes the default output for the log package.
Types ¶
type Config ¶
type Config struct {
// Token is the Telegram Bot API token
Token string
// ChatID is the target chat/channel ID where logs will be sent
ChatID int64
// ForumTopicID optional ID for forum messages (0 for regular chats)
ForumTopicID int
// Title appears at the top of each log message
Title string
// ExcludedLogPatterns are strings that when matched will prevent log entry from being sent
ExcludedLogPatterns []string
// UpdateInterval minimum time between log updates (default: 3s)
UpdateInterval time.Duration
// MinimumLines minimum number of lines before sending update (default: 1)
MinimumLines int
// PendingLogsSize maximum size of log buffer before sending as file (default: 20000)
PendingLogsSize int
// MaxMessageSize maximum size of a single message (default: 4096)
MaxMessageSize int
}
Config holds the configuration for TelegramLogger
type TelegramLogger ¶
type TelegramLogger struct {
// contains filtered or unexported fields
}
TelegramLogger implements log.Writer interface for sending logs to Telegram
type TelegramResponse ¶
Click to show internal directories.
Click to hide internal directories.