Documentation ¶
Index ¶
- Constants
- func Bool(v bool) *bool
- func BoolPtr(v *bool) bool
- func ConvertErrTypeFromFloat64(data float64) *errorType
- func GetEndpointsLogsIndexName(serviceName *string) *string
- func GetServiceLogsIndexName(serviceName *string) *string
- func Int(v int) *int
- func Int32(v int32) *int32
- func Int32Ptr(v *int32) int32
- func IntPtr(v *int) int
- func SetConfigs(conf *Configs) func(*ZapLogger) error
- func SetContext(ctx context.Context) func(*ZapLogger) error
- func String(v string) *string
- func StringPtr(v *string) string
- func TimePtrToTime(t *time.Time) (emptyTime time.Time)
- func TimeToTimePtr(t time.Time) *time.Time
- type App
- type Configs
- type ElasticPlugin
- func (e *ElasticPlugin) Close()
- func (e *ElasticPlugin) Connect(logger Logger) (err error)
- func (e *ElasticPlugin) InsertEndpointLogObjectString(log []byte) error
- func (e *ElasticPlugin) InsertEndpointLogObjectStruct(log interface{}) error
- func (e *ElasticPlugin) InsertServiceLogObjectString(log []byte) error
- func (e *ElasticPlugin) InsertServiceLogObjectStruct(log interface{}) error
- func (e *ElasticPlugin) Ping(ctx context.Context) bool
- func (e *ElasticPlugin) RemoveIndexByName(name *string) error
- func (e *ElasticPlugin) SetEndpointsLogsMap() error
- func (e *ElasticPlugin) SetMapping() (err error)
- func (e *ElasticPlugin) SetServiceLogsMap() error
- type EncoderType
- type EndpointLog
- type IndexPlugin
- type LogStorageType
- type Logger
- type ServiceLog
- type Storage
- type SyncLogsService
- type SyncService
- type ZapLogger
- func (l *ZapLogger) Close()
- func (l *ZapLogger) Connect()
- func (l *ZapLogger) ErrorEndpoint(log *EndpointLog)
- func (l *ZapLogger) ErrorService(log *ServiceLog)
- func (l *ZapLogger) FatalEndpoint(log *EndpointLog)
- func (l *ZapLogger) FatalService(log *ServiceLog)
- func (l *ZapLogger) GetConfigs() *Configs
- func (l *ZapLogger) GetZapNativeLogger() *zap.Logger
- func (l *ZapLogger) InfoEndpoint(log *EndpointLog)
- func (l *ZapLogger) InfoService(log *ServiceLog)
- func (l *ZapLogger) PanicEndpoint(log *EndpointLog)
- func (l *ZapLogger) PanicService(log *ServiceLog)
- func (l *ZapLogger) Ping(ctx context.Context) bool
- func (l *ZapLogger) WarnEndpoint(log *EndpointLog)
- func (l *ZapLogger) WarnService(log *ServiceLog)
Constants ¶
View Source
const ( ServiceLogType errorType = iota + 1 EndpointLogType )
Variables ¶
This section is empty.
Functions ¶
func ConvertErrTypeFromFloat64 ¶
func ConvertErrTypeFromFloat64(data float64) *errorType
func GetServiceLogsIndexName ¶
func SetConfigs ¶
Types ¶
type Configs ¶
type Configs struct { App App Encoder EncoderType Storage Storage }
type ElasticPlugin ¶
func (*ElasticPlugin) Close ¶
func (e *ElasticPlugin) Close()
func (*ElasticPlugin) Connect ¶
func (e *ElasticPlugin) Connect(logger Logger) (err error)
func (*ElasticPlugin) InsertEndpointLogObjectString ¶
func (e *ElasticPlugin) InsertEndpointLogObjectString(log []byte) error
func (*ElasticPlugin) InsertEndpointLogObjectStruct ¶
func (e *ElasticPlugin) InsertEndpointLogObjectStruct(log interface{}) error
func (*ElasticPlugin) InsertServiceLogObjectString ¶
func (e *ElasticPlugin) InsertServiceLogObjectString(log []byte) error
func (*ElasticPlugin) InsertServiceLogObjectStruct ¶
func (e *ElasticPlugin) InsertServiceLogObjectStruct(log interface{}) error
func (*ElasticPlugin) Ping ¶
func (e *ElasticPlugin) Ping(ctx context.Context) bool
Ping the ElasticSearch server
func (*ElasticPlugin) RemoveIndexByName ¶
func (e *ElasticPlugin) RemoveIndexByName(name *string) error
func (*ElasticPlugin) SetEndpointsLogsMap ¶
func (e *ElasticPlugin) SetEndpointsLogsMap() error
func (*ElasticPlugin) SetMapping ¶
func (e *ElasticPlugin) SetMapping() (err error)
func (*ElasticPlugin) SetServiceLogsMap ¶
func (e *ElasticPlugin) SetServiceLogsMap() error
type EncoderType ¶
type EncoderType int
const ( Console EncoderType = iota Json )
func EncoderFromStrConvert ¶
func EncoderFromStrConvert(t string) *EncoderType
func (EncoderType) String ¶
func (t EncoderType) String() string
func (EncoderType) Val ¶
func (t EncoderType) Val() int
type EndpointLog ¶
type EndpointLog struct { Level string `json:"level"` Msg *string `json:"msg,omitempty"` Timestamp time.Time `json:"timestamp,omitempty"` Error interface{} `json:"error,omitempty"` ServiceName string `json:"service_name"` InstancePublicIP string `json:"instance_public_ip"` Version string `json:"version"` Namespace *string `json:"namespace"` StackTrace *string `json:"stacktrace,omitempty"` Url *string `json:"url"` TraceID interface{} `json:"trace_id"` RequestBody interface{} `json:"request_body"` ResponseBody interface{} `json:"response_body"` Duration time.Duration `json:"duration"` // contains filtered or unexported fields }
func (EndpointLog) MarshalJSON ¶
func (e EndpointLog) MarshalJSON() ([]byte, error)
func (*EndpointLog) UnmarshalJSON ¶
func (e *EndpointLog) UnmarshalJSON(data []byte) (err error)
type IndexPlugin ¶
type IndexPlugin interface { Connect(Logger) (err error) Close() RemoveIndexByName(name *string) error SetMapping() (err error) Ping(context.Context) bool // indexing data... InsertServiceLogObjectStruct(interface{}) error InsertServiceLogObjectString([]byte) error InsertEndpointLogObjectStruct(interface{}) error InsertEndpointLogObjectString([]byte) error }
type LogStorageType ¶
type LogStorageType int
const ( Default LogStorageType = iota Elastic Loki )
func LogStorageFromStrConvert ¶
func LogStorageFromStrConvert(t string) *LogStorageType
func (LogStorageType) String ¶
func (t LogStorageType) String() string
func (LogStorageType) Val ¶
func (t LogStorageType) Val() int
type Logger ¶
type Logger interface { GetConfigs() *Configs Ping(context.Context) bool Connect() Close() // methods PanicEndpoint(log *EndpointLog) PanicService(log *ServiceLog) InfoEndpoint(log *EndpointLog) InfoService(log *ServiceLog) WarnEndpoint(log *EndpointLog) WarnService(log *ServiceLog) ErrorEndpoint(log *EndpointLog) ErrorService(log *ServiceLog) FatalEndpoint(log *EndpointLog) FatalService(log *ServiceLog) GetZapNativeLogger() *zap.Logger }
type ServiceLog ¶
type ServiceLog struct { Level string `json:"level"` Msg *string `json:"msg,omitempty"` Timestamp time.Time `json:"timestamp,omitempty"` Error interface{} `json:"error,omitempty"` ServiceName string `json:"service_name"` InstancePublicIP string `json:"instance_public_ip"` StackTrace *string `json:"stacktrace,omitempty"` Version string `json:"version"` Namespace *string `json:"namespace"` // contains filtered or unexported fields }
func (ServiceLog) MarshalJSON ¶
func (e ServiceLog) MarshalJSON() ([]byte, error)
func (*ServiceLog) UnmarshalJSON ¶
func (e *ServiceLog) UnmarshalJSON(data []byte) (err error)
type Storage ¶
type Storage struct { LoggerStorage LogStorageType Hosts []string }
type SyncLogsService ¶
type SyncLogsService struct {
// contains filtered or unexported fields
}
func NewSyncLogsService ¶
func NewSyncLogsService(ctx context.Context, logger Logger, readers ...*io.PipeReader) *SyncLogsService
func (*SyncLogsService) Close ¶
func (s *SyncLogsService) Close()
func (*SyncLogsService) RunLogsLoops ¶
func (s *SyncLogsService) RunLogsLoops()
type SyncService ¶
type ZapLogger ¶
type ZapLogger struct { Configs *Configs // contains filtered or unexported fields }
func NewZapLogger ¶
func (*ZapLogger) ErrorEndpoint ¶
func (l *ZapLogger) ErrorEndpoint(log *EndpointLog)
func (*ZapLogger) ErrorService ¶
func (l *ZapLogger) ErrorService(log *ServiceLog)
func (*ZapLogger) FatalEndpoint ¶
func (l *ZapLogger) FatalEndpoint(log *EndpointLog)
func (*ZapLogger) FatalService ¶
func (l *ZapLogger) FatalService(log *ServiceLog)
func (*ZapLogger) GetConfigs ¶
func (*ZapLogger) GetZapNativeLogger ¶
func (*ZapLogger) InfoEndpoint ¶
func (l *ZapLogger) InfoEndpoint(log *EndpointLog)
func (*ZapLogger) InfoService ¶
func (l *ZapLogger) InfoService(log *ServiceLog)
func (*ZapLogger) PanicEndpoint ¶
func (l *ZapLogger) PanicEndpoint(log *EndpointLog)
func (*ZapLogger) PanicService ¶
func (l *ZapLogger) PanicService(log *ServiceLog)
func (*ZapLogger) WarnEndpoint ¶
func (l *ZapLogger) WarnEndpoint(log *EndpointLog)
func (*ZapLogger) WarnService ¶
func (l *ZapLogger) WarnService(log *ServiceLog)
Click to show internal directories.
Click to hide internal directories.