logs

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateLogMessage

func CreateLogMessage(publicationPoint, campaign, signalID string, is models.ItemScore) ([]byte, error)

CreateLogMessage append extra information to the item score object

func ESCredentials

func ESCredentials(username, password string) func(*es.Config)

ESCredentials functional option for the kafka configuration

func KafkaCredentials

func KafkaCredentials(username, password string) func(*sarama.Config)

KafkaCredentials functional option for the kafka configuration For functional options see: https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis

func KafkaSASLMechanism

func KafkaSASLMechanism(m string) func(*sarama.Config)

KafkaSASLMechanism functional option for the kafka configuration Values accepted: "OAUTHBEARER", "PLAIN", "SCRAM-SHA-256", "SCRAM-SHA-512", "GSSAPI"

Types

type ElasticSearchLogs

type ElasticSearchLogs struct {
	Client    *es.Client
	IndexName string
}

ElasticSearchLogs is the struct that contains the information of ElasticSearch

func NewElasticSearchLogs

func NewElasticSearchLogs(addresses string, index string, options ...func(*es.Config)) (ElasticSearchLogs, error)

NewElasticSearchLogs creates a new object for sending logs to ElasticSearch For functional options see: https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis

func (ElasticSearchLogs) Write

func (es ElasticSearchLogs) Write(rl RowLog) error

type KakfaLog

type KakfaLog struct {
	Producer sarama.SyncProducer
	Topic    string
}

KakfaLog is the object for sending the logs to Kafa

func NewKafkaLogs

func NewKafkaLogs(brokers, topic string, options ...func(*sarama.Config)) (KakfaLog, error)

NewKafkaLogs create a new object for interacting with Kafka

func (KakfaLog) Close

func (k KakfaLog) Close() error

Close closes the producer object

func (KakfaLog) Write

func (k KakfaLog) Write(rl RowLog) error

type RecommendationLog

type RecommendationLog interface {
	Write(RowLog) error
}

RecommendationLog is the interface for the different type of logging system

type RowLog

type RowLog struct {
	PublicationPoint string
	Campaign         string
	SignalID         string
	ItemScores       []models.ItemScore
}

RowLog is the object that will be written in the logs

type StdoutLog

type StdoutLog struct {
	Client zerolog.Logger
}

StdoutLog is the object that handles the writing to stdout

func NewStdoutLog

func NewStdoutLog() StdoutLog

NewStdoutLog creates a new object for logging the recommendations to the stdoutput

func (StdoutLog) Write

func (s StdoutLog) Write(rl RowLog) error

Jump to

Keyboard shortcuts

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