Documentation ¶
Overview ¶
Copied from pluginapi/experimental/bot/logger to avoid upgrading min_server_version remove this file once pluginapi can be updated to 0.1.3+ ( min_server_version is
safe to point at 7.x)
Index ¶
Constants ¶
const ( // LogLevelDebug denotes debug messages LogLevelDebug = "debug" // LogLevelInfo denotes info messages LogLevelInfo = "info" // LogLevelWarn denotes warn messages LogLevelWarn = "warn" // LogLevelError denotes error messages LogLevelError = "error" )
const (
ErrorKey = "error"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { // Enqueue adds a tracker event (Track) to be registered Enqueue(t Track) error // Close closes the client connection, flushing any event left on the queue Close() error }
Client defines a telemetry client
func NewRudderClient ¶
NewRudderClient creates a new telemetry client with Rudder using the default configuration.
func NewRudderClientWithCredentials ¶
NewRudderClientWithCredentials lets you create a Rudder client with your own credentials.
type LogContext ¶
type LogContext map[string]interface{}
LogContext defines the context for the logs.
type Logger ¶
type Logger interface { // With adds a logContext to the logger. With(LogContext) Logger // WithError adds an Error to the logger. WithError(error) Logger // Context returns the current context Context() LogContext // Timed add a timed log context. Timed() Logger // Debugf logs a formatted string as a debug message. Debugf(format string, args ...interface{}) // Errorf logs a formatted string as an error message. Errorf(format string, args ...interface{}) // Infof logs a formatted string as an info message. Infof(format string, args ...interface{}) // Warnf logs a formatted string as an warning message. Warnf(format string, args ...interface{}) }
Logger defines an object able to log messages.
type Track ¶
type Track struct { UserID string Event string Properties map[string]interface{} InstallationID string }
Track defines an event ready for the client to process
type Tracker ¶
type Tracker interface { // TrackEvent registers an event through the configured telemetry client TrackEvent(event string, properties map[string]interface{}) error // TrackUserEvent registers an event through the configured telemetry client associated to a user TrackUserEvent(event string, userID string, properties map[string]interface{}) error // Reload Config re-evaluates tracker config to determine if tracking behavior should change ReloadConfig(config TrackerConfig) }
Tracker defines a telemetry tracker
func NewTracker ¶
func NewTracker( c Client, diagnosticID, serverVersion, pluginID, pluginVersion, telemetryShortName string, config TrackerConfig, l Logger, ) Tracker
NewTracker creates a default Tracker - c Client: A telemetry client. If nil, the tracker will not track any event. - diagnosticID: Server unique ID used for telemetry. - severVersion: Mattermost server version. - pluginID: The plugin ID. - pluginVersion: The plugin version. - telemetryShortName: Short name for the plugin to use in telemetry. Used to avoid dot separated names like `com.company.pluginName`. If a empty string is provided, it will use the pluginID. - config: Whether the system has enabled sending telemetry data. If false, the tracker will not track any event. - l Logger: A logger to debug event tracking and some important changes (it won't log if nil is passed as logger).
type TrackerConfig ¶
func NewTrackerConfig ¶
func NewTrackerConfig(config *model.Config) TrackerConfig
NewTrackerConfig returns a new trackerConfig from the current values of the model.Config.