vkcloudlogs

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2023 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v0.1.1

type Config struct {
	// Auth
	IdentityEndpoint string
	KeyFile          string
	UserID           string
	Username         string
	Password         string
	ProjectID        string
	// Server
	ServerHostPort string
	Tls            string
	TlsVerify      string
	// Tagging
	ServiceID       string
	GroupID         string
	StreamID        string
	DefaultPayload  string
	PayloadTemplate map[string]interface{}
	InternalRaw     string
	Internal        bool
	// Parsing
	MessageKey   string
	LevelKey     string
	DefaultLevel string
	GroupIDKey   string
	StreamIDKey  string
}

type LogServiceClientMock

type LogServiceClientMock struct {
	// WriteFunc mocks the Write method.
	WriteFunc func(ctx context.Context, in *gen.WriteRequest, opts ...grpc.CallOption) (*gen.WriteResponse, error)
	// contains filtered or unexported fields
}

LogServiceClientMock is a mock implementation of gen.LogServiceClient.

func TestSomethingThatUsesLogServiceClient(t *testing.T) {

	// make and configure a mocked gen.LogServiceClient
	mockedLogServiceClient := &LogServiceClientMock{
		WriteFunc: func(ctx context.Context, in *gen.WriteRequest, opts ...grpc.CallOption) (*gen.WriteResponse, error) {
			panic("mock out the Write method")
		},
	}

	// use mockedLogServiceClient in code that requires gen.LogServiceClient
	// and then make assertions.

}

func (*LogServiceClientMock) Write

Write calls WriteFunc.

func (*LogServiceClientMock) WriteCalls

func (mock *LogServiceClientMock) WriteCalls() []struct {
	Ctx  context.Context
	In   *gen.WriteRequest
	Opts []grpc.CallOption
}

WriteCalls gets all the calls that were made to Write. Check the length with:

len(mockedLogServiceClient.WriteCalls())

type Tag

type Tag struct {
	StreamID string
	GroupID  string
}

type VKCloudLogs

type VKCloudLogs struct {
	ApiClient gen.LogServiceClient
	Token     string
	Logger    *zap.SugaredLogger
	// contains filtered or unexported fields
}

func NewVKCloudLogs

func NewVKCloudLogs(cfg *Config, buildVersion string) (*VKCloudLogs, error)

func (*VKCloudLogs) Init

func (p *VKCloudLogs) Init() (err error)

func (*VKCloudLogs) Parse

func (p *VKCloudLogs) Parse(ts interface{}, fluentRecord map[interface{}]interface{}) (entry *gen.LogEntry, tag Tag)

func (*VKCloudLogs) Write

func (p *VKCloudLogs) Write(tag Tag, entries []*gen.LogEntry) int

Jump to

Keyboard shortcuts

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