Documentation ¶
Overview ¶
Package logger contains the configuration structures needed to configure the access to CloudWatch server to sending the log messages there.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var AWSCloudWatchEndpoint string
AWSCloudWatchEndpoint allows you to mock cloudwatch client by redirecting requests to a local proxy
Functions ¶
func CloseZerolog ¶ added in v1.7.0
func CloseZerolog()
CloseZerolog closes properly the zerolog, if needed
func InitZerolog ¶
func InitZerolog( loggingConf LoggingConfiguration, cloudWatchConf CloudWatchConfiguration, sentryConf SentryLoggingConfiguration, kafkazerologConf KafkaZerologConfiguration, additionalWriters ...io.Writer, ) error
InitZerolog initializes zerolog with provided configs to use proper stdout and/or CloudWatch logging
Types ¶
type CloudWatchConfiguration ¶
type CloudWatchConfiguration struct { AWSAccessID string `mapstructure:"aws_access_id" toml:"aws_access_id"` AWSSecretKey string `mapstructure:"aws_secret_key" toml:"aws_secret_key"` AWSSessionToken string `mapstructure:"aws_session_token" toml:"aws_session_token"` AWSRegion string `mapstructure:"aws_region" toml:"aws_region"` LogGroup string `mapstructure:"log_group" toml:"log_group"` StreamName string `mapstructure:"stream_name" toml:"stream_name"` CreateStreamIfNotExists bool `mapstructure:"create_stream_if_not_exists" toml:"create_stream_if_not_exists"` // enable debug logs for debugging aws client itself Debug bool `mapstructure:"debug" toml:"debug"` }
CloudWatchConfiguration represents configuration of CloudWatch logger
type KafkaZerologConfiguration ¶ added in v1.8.0
type KafkaZerologConfiguration struct { Broker string `mapstructure:"broker" toml:"broker"` Topic string `mapstructure:"topic" toml:"topic"` CertPath string `mapstructure:"cert_path" toml:"cert_path"` Level string `mapstructure:"level" toml:"level"` }
KafkaZerologConfiguration represetns the configuration for sending log messages to a Kafka topic
type LoggingConfiguration ¶
type LoggingConfiguration struct { // Debug enables pretty colored logging Debug bool `mapstructure:"debug" toml:"debug"` UseStderr bool `mapstructure:"use_stderr" toml:"use_stderr"` // LogLevel sets logging level to show. Possible values are: // "debug" // "info" // "warn", "warning" // "error" // "fatal" // // logging level won't be changed if value is not one of listed above LogLevel string `mapstructure:"log_level" toml:"log_level"` // LoggingToCloudWatchEnabled enables logging to CloudWatch // (configuration for CloudWatch is in CloudWatchConfiguration) LoggingToCloudWatchEnabled bool `mapstructure:"logging_to_cloud_watch_enabled" toml:"logging_to_cloud_watch_enabled"` // LoggingToSentryEnabled enables logging to Sentry // (configuration for Sentry is in SentryLoggingConfiguration) LoggingToSentryEnabled bool `mapstructure:"logging_to_sentry_enabled" toml:"logging_to_sentry_enabled"` // LoggingToKafkaEnabled enables logging to Kafka // (configuration for Kafka logging is in KafkaZerologConfiguration) LoggingToKafkaEnabled bool `mapstructure:"logging_to_kafka_enabled" toml:"logging_to_kafka_enabled"` }
LoggingConfiguration represents configuration for logging in general
type SaramaZerologger ¶
type SaramaZerologger struct {
// contains filtered or unexported fields
}
SaramaZerologger is a wrapper to make sarama log to zerolog those logs can be filtered by key "package" with value "sarama"
func (*SaramaZerologger) Print ¶
func (logger *SaramaZerologger) Print(params ...interface{})
Print wraps print method
func (*SaramaZerologger) Printf ¶
func (logger *SaramaZerologger) Printf(format string, params ...interface{})
Printf wraps printf method
func (*SaramaZerologger) Println ¶
func (logger *SaramaZerologger) Println(v ...interface{})
Println wraps println method
type SentryLoggingConfiguration ¶ added in v1.7.0
type SentryLoggingConfiguration struct {
SentryDSN string `mapstructure:"dsn" toml:"dsn"`
}
SentryLoggingConfiguration represents the configuration of Sentry logger
type WorkaroundForRHIOPS729 ¶
WorkaroundForRHIOPS729 keeps only those fields that are currently getting their way to Kibana TODO: delete when RHIOPS-729 is fixed