log

package
v0.0.0-...-694aa1c Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LogType_name = map[int32]string{
		0: "None",
		1: "Console",
		2: "File",
		3: "Event",
	}
	LogType_value = map[string]int32{
		"None":    0,
		"Console": 1,
		"File":    2,
		"Event":   3,
	}
)

Enum value maps for LogType.

View Source
var File_app_log_config_proto protoreflect.FileDescriptor

Functions

func RegisterHandlerCreator

func RegisterHandlerCreator(logType LogType, f HandlerCreator) error

Types

type Config

type Config struct {
	ErrorLogType  LogType      `` /* 126-byte string literal not displayed */
	ErrorLogLevel log.Severity `` /* 133-byte string literal not displayed */
	ErrorLogPath  string       `protobuf:"bytes,3,opt,name=error_log_path,json=errorLogPath,proto3" json:"error_log_path,omitempty"`
	AccessLogType LogType      `` /* 129-byte string literal not displayed */
	AccessLogPath string       `protobuf:"bytes,5,opt,name=access_log_path,json=accessLogPath,proto3" json:"access_log_path,omitempty"`
	EnableDnsLog  bool         `protobuf:"varint,6,opt,name=enable_dns_log,json=enableDnsLog,proto3" json:"enable_dns_log,omitempty"`
	MaskAddress   string       `protobuf:"bytes,7,opt,name=mask_address,json=maskAddress,proto3" json:"mask_address,omitempty"`
	// contains filtered or unexported fields
}

func (*Config) Descriptor deprecated

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

Deprecated: Use Config.ProtoReflect.Descriptor instead.

func (*Config) GetAccessLogPath

func (x *Config) GetAccessLogPath() string

func (*Config) GetAccessLogType

func (x *Config) GetAccessLogType() LogType

func (*Config) GetEnableDnsLog

func (x *Config) GetEnableDnsLog() bool

func (*Config) GetErrorLogLevel

func (x *Config) GetErrorLogLevel() log.Severity

func (*Config) GetErrorLogPath

func (x *Config) GetErrorLogPath() string

func (*Config) GetErrorLogType

func (x *Config) GetErrorLogType() LogType

func (*Config) GetMaskAddress

func (x *Config) GetMaskAddress() string

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) ProtoReflect

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

func (*Config) Reset

func (x *Config) Reset()

func (*Config) String

func (x *Config) String() string

type HandlerCreator

type HandlerCreator func(LogType, HandlerCreatorOptions) (log.Handler, error)

type HandlerCreatorOptions

type HandlerCreatorOptions struct {
	Path string
}

type Instance

type Instance struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Instance is a log.Handler that handles logs.

func New

func New(ctx context.Context, config *Config) (*Instance, error)

New creates a new log.Instance based on the given config.

func (*Instance) Close

func (g *Instance) Close() error

Close implements common.Closable.Close().

func (*Instance) Handle

func (g *Instance) Handle(msg log.Message)

Handle implements log.Handler.

func (*Instance) Start

func (g *Instance) Start() error

Start implements common.Runnable.Start().

func (*Instance) Type

func (*Instance) Type() interface{}

Type implements common.HasType.

type LogType

type LogType int32
const (
	LogType_None    LogType = 0
	LogType_Console LogType = 1
	LogType_File    LogType = 2
	LogType_Event   LogType = 3
)

func (LogType) Descriptor

func (LogType) Descriptor() protoreflect.EnumDescriptor

func (LogType) Enum

func (x LogType) Enum() *LogType

func (LogType) EnumDescriptor deprecated

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

Deprecated: Use LogType.Descriptor instead.

func (LogType) Number

func (x LogType) Number() protoreflect.EnumNumber

func (LogType) String

func (x LogType) String() string

func (LogType) Type

func (LogType) Type() protoreflect.EnumType

type MaskedMsgWrapper

type MaskedMsgWrapper struct {
	log.Message
	// contains filtered or unexported fields
}

MaskedMsgWrapper is to wrap the string() method to mask IP addresses in the log.

func (*MaskedMsgWrapper) String

func (m *MaskedMsgWrapper) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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