logtransports

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPrefixVal = 0

DefaultPrefixVal is a constant indicating that default Go prefix should be used

View Source
const NoPrefixVal = -1

NoPrefixVal is a constant indicating that no prefix should be used

Variables

This section is empty.

Functions

func Close

func Close()

Close performs any additional clean up and then call uclog.Close()

func EncodeLogForTransfer

func EncodeLogForTransfer(logRecords *logRecord, region region.MachineRegion, host string, service service.Service) []*uclog.LogRecordArray

EncodeLogForTransfer aggregates log messages for more efficient the wire transfer to avoid hitting limits on number of Kinesis record per second and to improve the read performance For now we unify up to 1001 (maxLogRecordPerKinesisRecord) log messages/events into a single LogRecordArray to be sent as a single Kinesis record. Each Kinesis record is limited to 1MB so we are staying well under that. Each LogRecordArray has same service/region/host/tenant and then a set of log message/event contents

func InitLoggerAndTransportsForSDK

func InitLoggerAndTransportsForSDK(config *Config, auth *ucjwt.Config, name service.Service)

InitLoggerAndTransportsForSDK sets up logging transports for SDK

func InitLoggerAndTransportsForService added in v0.7.4

func InitLoggerAndTransportsForService(config *Config, auth *ucjwt.Config, name service.Service)

InitLoggerAndTransportsForService sets up logging transports for long running serving

func InitLoggerAndTransportsForTools added in v0.7.4

func InitLoggerAndTransportsForTools(ctx context.Context, lScreen uclog.LogLevel, lFile uclog.LogLevel, toolName string, opts ...ToolLogOption)

InitLoggerAndTransportsForTools configures logging to the screen and file if desired for a tool

func InitLoggingSDK

func InitLoggingSDK(auth *ucjwt.Config, rawLogs bool)

InitLoggingSDK sets up logging transport for SDK

func InitTransportsForTests added in v0.7.4

func InitTransportsForTests(config *Config, auth *ucjwt.Config, name service.Service) []uclog.Transport

InitTransportsForTests returns an array of setup transports to use in testing

Types

type Config

type Config struct {
	Transports   TransportConfigs `yaml:"transports" json:"transports"`
	NoRequestIDs bool             `yaml:"no_request_ids" json:"no_request_ids"`
}

Config defines overall logging configuration

func (Config) Validate added in v0.7.2

func (o Config) Validate() error

Validate implements Validateable

type FileTransportConfig added in v0.7.4

type FileTransportConfig struct {
	Type                  TransportType `yaml:"type" json:"type"`
	uclog.TransportConfig `yaml:"transportconfig" json:"transportconfig"`
	Filename              string `yaml:"filename" json:"filename"`
	Append                bool   `yaml:"append" json:"append"`
	PrefixFlag            int    `yaml:"prefix_flag" json:"prefix_flag"`
	NoRequestIDs          bool   `yaml:"no_request_ids" json:"no_request_ids"`
}

FileTransportConfig defines log-to-file client config

func (FileTransportConfig) GetTransport added in v0.7.4

GetTransport implements TransportConfig

func (FileTransportConfig) GetType added in v0.7.4

func (c FileTransportConfig) GetType() TransportType

GetType implements TransportConfig

func (*FileTransportConfig) Validate added in v0.7.4

func (c *FileTransportConfig) Validate() error

Validate implements Validateable

type GoTransportConfig added in v0.7.4

type GoTransportConfig struct {
	Type                  TransportType `yaml:"type" json:"type"`
	uclog.TransportConfig `yaml:"transportconfig" json:"transportconfig"`
	PrefixFlag            int  `yaml:"prefix_flag" json:"prefix_flag"`
	SupportsColor         bool `yaml:"supports_color" json:"supports_color"`
	NoRequestIDs          bool `yaml:"no_request_ids" json:"no_request_ids"`
}

GoTransportConfig defines go logger client config

func (GoTransportConfig) GetTransport added in v0.7.4

GetTransport implements TransportConfig

func (GoTransportConfig) GetType added in v0.7.4

func (c GoTransportConfig) GetType() TransportType

GetType implements TransportConfig

func (*GoTransportConfig) Validate added in v0.7.4

func (c *GoTransportConfig) Validate() error

Validate implements Validateable

type LogServerTransportConfig

type LogServerTransportConfig struct {
	Type                  TransportType `yaml:"type" json:"type"`
	uclog.TransportConfig `yaml:"transportconfig" json:"transportconfig"`
	TenantID              uuid.UUID `yaml:"tenant_id" json:"tenant_id"`
	LogServiceURL         string    `yaml:"log_service_url" json:"log_service_url"`
	Service               string    `yaml:"service" json:"service"`
	SendRawData           bool      `yaml:"send_raw_data" json:"send_raw_data"`
}

LogServerTransportConfig defines the configuration for transport sending events to our servers

func (LogServerTransportConfig) GetTransport added in v0.7.2

func (c LogServerTransportConfig) GetTransport(name service.Service, auth *ucjwt.Config) uclog.Transport

GetTransport implements TransportConfig

func (LogServerTransportConfig) GetType added in v0.7.2

GetType implements TransportConfig

func (*LogServerTransportConfig) Validate added in v0.7.2

func (c *LogServerTransportConfig) Validate() error

Validate implements Validateable

type ToolLogConfig added in v0.7.4

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

ToolLogConfig describes optional parameters for configuring logging for a tool

type ToolLogOption added in v0.7.4

type ToolLogOption interface {
	// contains filtered or unexported methods
}

ToolLogOption defines a way to pass optional configuration parameters.

func Filename added in v0.7.4

func Filename(filename string) ToolLogOption

Filename allows specification of the filename to be used by the file logger

func NoPrefix added in v0.7.4

func NoPrefix() ToolLogOption

NoPrefix specifies that there should be no prefix used by the logger on the screen

func Prefix added in v0.7.4

func Prefix(prefix int) ToolLogOption

Prefix allows specification of the prefix to be used by the logger on the screen

func SupportsColor added in v0.7.5

func SupportsColor() ToolLogOption

SupportsColor specifies that terminal supports color

type TransportConfig added in v0.7.2

type TransportConfig interface {
	GetTransport(service.Service, *ucjwt.Config) uclog.Transport
	GetType() TransportType
	Validate() error
}

TransportConfig defines the interface for a transport config

type TransportConfigs added in v0.7.2

type TransportConfigs []TransportConfig

TransportConfigs is an alias for an array of TransportConfig so we can handle polymorphic config unmarshalling

func (*TransportConfigs) UnmarshalYAML added in v0.7.2

func (t *TransportConfigs) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements yaml.Unmarshaler

type TransportType added in v0.7.2

type TransportType string

TransportType defines the type of transport

const TransportTypeFile TransportType = "file"

TransportTypeFile defines the file transport

const TransportTypeGo TransportType = "go"

TransportTypeGo defines the Go transport

const TransportTypeServer TransportType = "server"

TransportTypeServer defines the server transport

Jump to

Keyboard shortcuts

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