statistics

package
v1.6.1-0...-105477e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 29, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const ButtonClicksDirPath = "buttons"
View Source
const CommandsDirPath = "commands"

Variables

This section is empty.

Functions

This section is empty.

Types

type FileLogger

type FileLogger struct {
	// contains filtered or unexported fields
}

FileLogger is a logger that logs statistics events to the files.

It implements Logger interface.

func (*FileLogger) LogButtonClick

func (l *FileLogger) LogButtonClick(chatId int64, userId int64, messageId int, button string) error

func (*FileLogger) LogCommand

func (l *FileLogger) LogCommand(chatId int64, userId int64, messageId int, command string) error

type Logger

type Logger interface {
	// LogButtonClick logs a user button click to the database.
	LogButtonClick(chatId int64, userId int64, messageId int, button string) error
	// LogCommand logs a bot command from user.
	LogCommand(chatId int64, userId int64, messageId int, command string) error
}

Logger is an interface for logging statistics events.

func NewFileLogger

func NewFileLogger(dir string) (Logger, error)

NewFileLogger creates a new logger that logs statistics events to the files.

func NewPostgresLogger

func NewPostgresLogger(db *sqlx.DB) Logger

NewPostgresLogger creates a new logger that logs statistics events to the database.

type PostgresLogger

type PostgresLogger struct {
	// contains filtered or unexported fields
}

PostgresLogger is a logger that logs statistics events to the database.

It implements Logger interface.

func (*PostgresLogger) LogButtonClick

func (l *PostgresLogger) LogButtonClick(chatId int64, userId int64, messageId int, button string) error

func (*PostgresLogger) LogCommand

func (l *PostgresLogger) LogCommand(chatId int64, userId int64, messageId int, command string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL