core

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2024 License: MIT Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CoreType_name = map[int32]string{
		0: "Unkown",
		1: "Stdout",
		2: "File",
		3: "Fluent",
		4: "CloudWatch",
		5: "AliYun",
		6: "Sys",
		7: "Hc",
	}
	CoreType_value = map[string]int32{
		"Unkown":     0,
		"Stdout":     1,
		"File":       2,
		"Fluent":     3,
		"CloudWatch": 4,
		"AliYun":     5,
		"Sys":        6,
		"Hc":         7,
	}
)

Enum value maps for CoreType.

View Source
var File_log_core_conf_proto protoreflect.FileDescriptor

Functions

func Register added in v0.0.39

func Register(name string, factory Factory)

Register registers one cores.

Types

type Conf added in v0.0.39

type Conf struct {
	Type         CoreType `protobuf:"varint,1,opt,name=type,proto3,enum=log.core.CoreType" json:"type,omitempty"`
	Level        int32    `protobuf:"varint,2,opt,name=level,proto3" json:"level,omitempty"`
	Path         string   `protobuf:"bytes,3,opt,name=path,proto3" json:"path,omitempty"`
	Endpoint     string   `protobuf:"bytes,4,opt,name=endpoint,proto3" json:"endpoint,omitempty"`
	Key          string   `protobuf:"bytes,5,opt,name=key,proto3" json:"key,omitempty"`
	Secret       string   `protobuf:"bytes,6,opt,name=secret,proto3" json:"secret,omitempty"`
	Region       string   `protobuf:"bytes,7,opt,name=region,proto3" json:"region,omitempty"`
	Profile      string   `protobuf:"bytes,8,opt,name=profile,proto3" json:"profile,omitempty"`
	LogGroupName string   `protobuf:"bytes,9,opt,name=logGroupName,proto3" json:"logGroupName,omitempty"`
	// contains filtered or unexported fields
}

func (*Conf) Descriptor deprecated added in v0.0.39

func (*Conf) Descriptor() ([]byte, []int)

Deprecated: Use Conf.ProtoReflect.Descriptor instead.

func (*Conf) GetEndpoint added in v0.0.39

func (x *Conf) GetEndpoint() string

func (*Conf) GetKey added in v0.0.39

func (x *Conf) GetKey() string

func (*Conf) GetLevel added in v0.0.39

func (x *Conf) GetLevel() int32

func (*Conf) GetLogGroupName added in v0.0.39

func (x *Conf) GetLogGroupName() string

func (*Conf) GetPath added in v0.0.39

func (x *Conf) GetPath() string

func (*Conf) GetProfile added in v0.0.39

func (x *Conf) GetProfile() string

func (*Conf) GetRegion added in v0.0.39

func (x *Conf) GetRegion() string

func (*Conf) GetSecret added in v0.0.39

func (x *Conf) GetSecret() string

func (*Conf) GetType added in v0.0.39

func (x *Conf) GetType() CoreType

func (*Conf) ProtoMessage added in v0.0.39

func (*Conf) ProtoMessage()

func (*Conf) ProtoReflect added in v0.0.39

func (x *Conf) ProtoReflect() protoreflect.Message

func (*Conf) Reset added in v0.0.39

func (x *Conf) Reset()

func (*Conf) String added in v0.0.39

func (x *Conf) String() string

func (*Conf) Validate added in v0.0.39

func (m *Conf) Validate() error

Validate checks the field values on Conf with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*Conf) ValidateAll added in v0.0.39

func (m *Conf) ValidateAll() error

ValidateAll checks the field values on Conf with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in ConfMultiError, or nil if none found.

type ConfMultiError added in v0.0.39

type ConfMultiError []error

ConfMultiError is an error wrapping multiple validation errors returned by Conf.ValidateAll() if the designated constraints aren't met.

func (ConfMultiError) AllErrors added in v0.0.39

func (m ConfMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (ConfMultiError) Error added in v0.0.39

func (m ConfMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type ConfValidationError added in v0.0.39

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

ConfValidationError is the validation error returned by Conf.Validate if the designated constraints aren't met.

func (ConfValidationError) Cause added in v0.0.39

func (e ConfValidationError) Cause() error

Cause function returns cause value.

func (ConfValidationError) Error added in v0.0.39

func (e ConfValidationError) Error() string

Error satisfies the builtin error interface

func (ConfValidationError) ErrorName added in v0.0.39

func (e ConfValidationError) ErrorName() string

ErrorName returns error name.

func (ConfValidationError) Field added in v0.0.39

func (e ConfValidationError) Field() string

Field function returns field value.

func (ConfValidationError) Key added in v0.0.39

func (e ConfValidationError) Key() bool

Key function returns key value.

func (ConfValidationError) Reason added in v0.0.39

func (e ConfValidationError) Reason() string

Reason function returns reason value.

type CoreType added in v0.0.39

type CoreType int32
const (
	CoreType_Unkown     CoreType = 0
	CoreType_Stdout     CoreType = 1
	CoreType_File       CoreType = 2
	CoreType_Fluent     CoreType = 3
	CoreType_CloudWatch CoreType = 4
	CoreType_AliYun     CoreType = 5
	CoreType_Sys        CoreType = 6
	CoreType_Hc         CoreType = 7
)

func (CoreType) Descriptor added in v0.0.39

func (CoreType) Descriptor() protoreflect.EnumDescriptor

func (CoreType) Enum added in v0.0.39

func (x CoreType) Enum() *CoreType

func (CoreType) EnumDescriptor deprecated added in v0.0.39

func (CoreType) EnumDescriptor() ([]byte, []int)

Deprecated: Use CoreType.Descriptor instead.

func (CoreType) Number added in v0.0.39

func (x CoreType) Number() protoreflect.EnumNumber

func (CoreType) String added in v0.0.39

func (x CoreType) String() string

func (CoreType) Type added in v0.0.39

type Factory added in v0.0.39

type Factory func(c *Conf) (Logger, error)

type Level added in v0.0.39

type Level = zapcore.Level
const (
	// DebugLevel logs are typically voluminous, and are usually disabled in
	// production.
	DebugLevel Level = iota - 1
	// InfoLevel is the default logging priority.
	InfoLevel
	// WarnLevel logs are more important than Info, but don't need individual
	// human review.
	WarnLevel
	// ErrorLevel logs are high-priority. If an application is running smoothly,
	// it shouldn't generate any error-level logs.
	ErrorLevel
	// DPanicLevel logs are particularly important errors. In development the
	// logger panics after writing the message.
	DPanicLevel
	// PanicLevel logs a message, then panics.
	PanicLevel
	// FatalLevel logs a message, then calls os.Exit(1).
	FatalLevel

	// InvalidLevel is an invalid value for Level.
	//
	// Core implementations may panic if they see messages of this level.
	InvalidLevel = _maxLevel + 1
)

type Logger

type Logger interface {
	zapcore.Core
	Close()
}

func Create added in v0.0.39

func Create(c *Conf) (Logger, error)

Create instantiates a cores based on `discoveryDSN`.

func MustCreate added in v0.0.39

func MustCreate(c *Conf) Logger

MustCreate instantiates a cores based on `discoveryDSN`.

type Registry added in v0.0.39

type Registry interface {
	Register(name string, factory Factory)
	Create(c *Conf) (Logger, error)
}

Registry is the interface for callers to get registered middleware.

func NewRegistry added in v0.0.39

func NewRegistry() Registry

NewRegistry returns a new middleware registry.

Jump to

Keyboard shortcuts

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