logger

package
v0.0.0-rc11 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

Дефолтный логгер. В ыте будет консольный. В nanny будет json-ый. В дев тачке будет прекрасный.

View Source
var NullLog *zap.Logger

Functions

func AdditionalComponentCallerEncoder

func AdditionalComponentCallerEncoder(caller zapcore.EntryCaller, enc zapcore.PrimitiveArrayEncoder)

func DefaultLoggerConfig

func DefaultLoggerConfig(level zapcore.Level) zp.Config

func DummyLoggerFactory

func DummyLoggerFactory(ctx context.Context) log.Logger

func ExtractYTLogger

func ExtractYTLogger(lgr log.Logger) log.Logger

ExtractYTLogger is a helper function to extract YT log. If the `lgr` parameter is not of thge type logger.YtLogBundle, then the log returned itself, otherwise log for YT is returned

func LogLevel

func LogLevel() string

func LoggerWithLevel

func LoggerWithLevel(lvl zapcore.Level) log.Logger

func NewConsoleLogger

func NewConsoleLogger() log.Logger

func NewKafkaLogger

func NewKafkaLogger(cfg *KafkaConfig) (*zap.Logger, io.Closer, error)

func NewMutableRegistry

func NewMutableRegistry(registry metrics.Registry) metrics.Registry

Types

type Factory

type Factory func(context.Context) log.Logger

type JSONTruncator

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

func NewJSONTruncator

func NewJSONTruncator(
	writer io.Writer,
	logger log.Logger,
	config JSONTruncatorConfig,
	registry metrics.Registry,
) *JSONTruncator

func (*JSONTruncator) Write

func (w *JSONTruncator) Write(p []byte) (int, error)

type JSONTruncatorConfig

type JSONTruncatorConfig struct {
	TotalLimit  int
	StringLimit int
	BytesLimit  int
}

type KafkaConfig

type KafkaConfig struct {
	Broker      string
	Topic       string
	User        string
	Password    string
	TLSFiles    []string
	TLSInsecure bool
}

type LeakyWriter

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

func NewLeakyWriter

func NewLeakyWriter(writer Writer, registry metrics.Registry, maxSize int) *LeakyWriter

func (*LeakyWriter) Write

func (w *LeakyWriter) Write(p []byte) (int, error)

type LogLevelSetter

type LogLevelSetter struct {
	LogLevel string `yaml:"log_level"`
}

type Writer

type Writer interface {
	io.Writer

	CanWrite() bool
}

type YtLogBundle

type YtLogBundle interface {
	log.Logger
	// ExtractYTLogger extracts YT logger with different settings but all registered "with" values applied to main worker
	ExtractYTLogger() log.Logger
}

YtLogBundle is a logger that holds reference to YT Logger in order to hook all "with's" modification and apply them syncrhonously. You may override other hooks.

func NewYtLogBundle

func NewYtLogBundle(log, ytLogger log.Logger) YtLogBundle

NewYtLogBundle constructs LogBundle from two loggers: original one and separate logger for YT. Acts like standard zap.Must(config), but hooks system log calls "With" to apply to zap.Must(ytConfig)

Jump to

Keyboard shortcuts

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