chore: retrieved base logic files from matrix bridge

This commit is contained in:
Felipe M 2025-07-31 12:17:24 +02:00
parent b10a439a29
commit 202622f2c4
No known key found for this signature in database
GPG key ID: 52E5D65FCF99808A
5 changed files with 600 additions and 1 deletions

41
server/logger.go Normal file
View file

@ -0,0 +1,41 @@
package main
import "github.com/mattermost/mattermost/server/public/plugin"
// Logger interface for logging operations
type Logger interface {
LogDebug(message string, keyValuePairs ...any)
LogInfo(message string, keyValuePairs ...any)
LogWarn(message string, keyValuePairs ...any)
LogError(message string, keyValuePairs ...any)
}
// PluginAPILogger adapts the plugin.API to implement the Logger interface
type PluginAPILogger struct {
api plugin.API
}
// NewPluginAPILogger creates a new PluginAPILogger
func NewPluginAPILogger(api plugin.API) Logger {
return &PluginAPILogger{api: api}
}
// LogDebug logs a debug message
func (l *PluginAPILogger) LogDebug(message string, keyValuePairs ...any) {
l.api.LogDebug(message, keyValuePairs...)
}
// LogInfo logs an info message
func (l *PluginAPILogger) LogInfo(message string, keyValuePairs ...any) {
l.api.LogInfo(message, keyValuePairs...)
}
// LogWarn logs a warning message
func (l *PluginAPILogger) LogWarn(message string, keyValuePairs ...any) {
l.api.LogWarn(message, keyValuePairs...)
}
// LogError logs an error message
func (l *PluginAPILogger) LogError(message string, keyValuePairs ...any) {
l.api.LogError(message, keyValuePairs...)
}