logdriver

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ZapLogger     = "zap"
	SentryLogger  = "sentry"
	PrinterLogger = "printer"
)

Variables

This section is empty.

Functions

func DefaultZapConfig

func DefaultZapConfig(debug bool, level zapcore.Level, encoding string) zap.Config

DefaultZapConfig generate zap config using default values. You can leave encoding empty to set to the default value which is json.

func NewSentryDriver

func NewSentryDriver(o SentryOptions) (hlog.Logger, error)

NewSentryDriver return new instance of hexa logger with sentry driver.

func NewSentryDriverWith

func NewSentryDriverWith(hub *sentry.Hub) hlog.Logger

NewSentryDriverWith get the sentry hub and returns new instance of sentry driver for hexa logger.

func NewStackLoggerDriver

func NewStackLoggerDriver(stackList []string, opts StackOptions) (hlog.Logger, error)

NewStackLoggerDriver return new stacked logger . If logger name is invalid,it will return error.

func NewStackLoggerDriverWith

func NewStackLoggerDriverWith(lvl hlog.Level, stack map[string]hlog.Logger) hlog.Logger

NewStackLoggerDriverWith return new instance of hexa logger with stacked logger driver.

func NewZapDriver

func NewZapDriver(logger *zap.Logger) hlog.Logger

NewZapDriver return new instance of hexa logger with zap driver.

func NewZapDriverFromConfig

func NewZapDriverFromConfig(cfg zap.Config) hlog.Logger

Types

type SentryOptions

type SentryOptions struct {
	DSN         string
	Debug       bool
	Environment string
}

type StackOptions

type StackOptions struct {
	Level      hlog.Level
	ZapConfig  zap.Config
	SentryOpts *SentryOptions
}

type StackedLogger

type StackedLogger interface {
	// LoggerByName returns logger by its name.
	// logger can be nil if does not exists.
	LoggerByName(name string) hlog.Logger

	hexa.Bootable
	hexa.Runnable
	hexa.Shutdownable
}

type ZapOptions

type ZapOptions struct {
	Debug bool
	Level zapcore.Level
}

Jump to

Keyboard shortcuts

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