Documentation ¶
Index ¶
- Constants
- Variables
- func ConditionOne(v string) zap.Field
- func ConditionThree(v string) zap.Field
- func ConditionTwo(v string) zap.Field
- func FieldTraceID(ctx context.Context) zap.Field
- func TraceID(ctx context.Context) types.TraceID
- func WithTraceID(ctx context.Context) context.Context
- type DataPacket
- type LocalOption
- type LocalResolverBuilder
- type Logger
- func (lg *Logger) Close() error
- func (lg *Logger) ConditionOne(v interface{}) zap.Field
- func (lg *Logger) ConditionThree(v interface{}) zap.Field
- func (lg *Logger) ConditionTwo(v interface{}) zap.Field
- func (lg *Logger) FieldTraceID(ctx context.Context) zap.Field
- func (lg *Logger) NewLevelWriter(level zapcore.Level, msg string) *Writer
- func (lg *Logger) SetEnabledLevel(lvl zapcore.Level) *Logger
- func (lg *Logger) TraceID(ctx context.Context) types.TraceID
- func (lg *Logger) WithTraceID(ctx context.Context) context.Context
- type Mode
- type Option
- func WithAddrsAndModuleName(addrs []string, moduleName string) Option
- func WithFilename(filename string) Option
- func WithGzipCompress(enable bool) Option
- func WithLevel(lvl zapcore.Level) Option
- func WithMode(mode Mode) Option
- func WithRemoteConcurrent(n uint) Option
- func WithRemotePacketSize(n uint) Option
- func WithRemoteWriteTimeout(timeout time.Duration) Option
- func WithRotateMaxSizeAge(size uint64, age time.Duration) Option
- func WithTransport(trans Transport) Option
- func WithZapOptions(opts ...zap.Option) Option
- type Packet
- type Pusher
- type Transport
- type WriteLocal
- type WriteRemote
- type Writer
Constants ¶
const ( LocalServiceName = "grpc_local_resolver_name" LocalScheme = "local" )
Variables ¶
var (
DialLocalServiceName = fmt.Sprintf("%s:///%s", LocalScheme, LocalServiceName)
)
var (
)Functions ¶
func FieldTraceID ¶
FieldTraceID wrap internal field
Types ¶
type DataPacket ¶
type DataPacket struct {
// contains filtered or unexported fields
}
func (*DataPacket) CanPush ¶
func (d *DataPacket) CanPush() bool
func (*DataPacket) Data ¶
func (d *DataPacket) Data() *receiverpb.Packet
func (*DataPacket) IsEmpty ¶
func (d *DataPacket) IsEmpty() bool
type LocalOption ¶
type LocalOption struct { // local fs filename Filename string // single file max size, if 0 do not cut file. default: 500MB MaxSize int64 // cut file max keep time. default: 0 keep forever MaxAge time.Duration // cut file enable Gzip compress. default: true GzipCompress bool }
func DefaultLocalOption ¶
func DefaultLocalOption() *LocalOption
type LocalResolverBuilder ¶
type LocalResolverBuilder struct {
// contains filtered or unexported fields
}
LocalResolverBuilder impl local address resolver, used for GRPC load balancing
func NewLocalResolverBuilder ¶
func NewLocalResolverBuilder(address []string) *LocalResolverBuilder
func (*LocalResolverBuilder) Build ¶
func (lrb *LocalResolverBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions) (resolver.Resolver, error)
func (*LocalResolverBuilder) Scheme ¶
func (*LocalResolverBuilder) Scheme() string
type Logger ¶
func New ¶
New wrap zap.Logger, impl multi writer local writer written to fs. remote writer, rely on GRPC or HTTP protocol written remote storage you can also only select local fs.
func (*Logger) ConditionOne ¶
ConditionOne internal field extension, used for first condition filtering
func (*Logger) ConditionThree ¶
ConditionThree internal field extension, used for third condition filtering
func (*Logger) ConditionTwo ¶
ConditionTwo internal field extension, used for second condition filtering
func (*Logger) FieldTraceID ¶
FieldTraceID internal field extension, used for trace context filtering
func (*Logger) NewLevelWriter ¶
NewLevelWriter returns io.Writer impl fixed msg for remote storage index performance
func (*Logger) SetEnabledLevel ¶
SetEnabledLevel runtime change logger level
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option setting options
func WithAddrsAndModuleName ¶
WithAddrsAndModuleName remote endpoint address, module name address eg HTTP:["http://xxx.com:31081/v1/receiver/packet"] GRPC:["192.168.10.1:31082","192.168.10.2:31082"] admin manager register module name, used to permission verify. eg "example"
func WithGzipCompress ¶
WithGzipCompress setting logger rotate gzip compress
func WithRemoteConcurrent ¶
WithRemoteConcurrent setting logger remote max concurrent
func WithRemotePacketSize ¶
WithRemotePacketSize setting logger remote max packet size, unit KB, limit 4MB
func WithRemoteWriteTimeout ¶
WithRemoteWriteTimeout setting logger remote timeout
func WithRotateMaxSizeAge ¶
WithRotateMaxSizeAge setting logger local fs rotate
func WithTransport ¶
WithTransport setting remote transport, MOCK used for test Pusher
func WithZapOptions ¶
WithZapOptions setting zap option
type Packet ¶
type Packet struct {
// contains filtered or unexported fields
}
func (*Packet) Append ¶
func (p *Packet) Append(b []byte) *DataPacket
Append warning: concurrent not safe
func (*Packet) DataPacket ¶
func (p *Packet) DataPacket() *DataPacket
func (*Packet) PoolPutDataPacket ¶
func (p *Packet) PoolPutDataPacket(d *DataPacket)
func (*Packet) SetCanPush ¶
func (p *Packet) SetCanPush(d *DataPacket)
func (*Packet) SwitchNextDataPacket ¶
func (p *Packet) SwitchNextDataPacket()
SwitchNextDataPacket current data have been processed, so set nil, switch next data packet
type WriteLocal ¶
type WriteLocal struct {
// contains filtered or unexported fields
}
WriteLocal local fs writer impl support rotate, gzip, maxAge
func NewWriteLocal ¶
func NewWriteLocal(opt *LocalOption) *WriteLocal
type WriteRemote ¶
type WriteRemote struct {
// contains filtered or unexported fields
}
func (*WriteRemote) Close ¶
func (w *WriteRemote) Close() error