config

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorParamEmpty liberr.CodeError = iota + liberr.MinPkgLogger
	ErrorValidatorError
)

Variables

This section is empty.

Functions

func DefaultConfig

func DefaultConfig(indent string) []byte

func SetDefaultConfig

func SetDefaultConfig(cfg []byte)

Types

type FuncOpt added in v1.11.1

type FuncOpt func() *Options

type Options added in v1.11.1

type Options struct {
	// InheritDefault define if the current options will override a default options
	InheritDefault bool `json:"inheritDefault" yaml:"inheritDefault" toml:"inheritDefault" mapstructure:"inheritDefault"`

	// TraceFilter define the path to clean for trace.
	TraceFilter string `json:"traceFilter,omitempty" yaml:"traceFilter,omitempty" toml:"traceFilter,omitempty" mapstructure:"traceFilter,omitempty"`

	// Stdout define the options for stdout/stderr log.
	Stdout *OptionsStd `json:"stdout,omitempty" yaml:"stdout,omitempty" toml:"stdout,omitempty" mapstructure:"stdout,omitempty"`

	// LogFileExtend define if the logFile given is in addition of default LogFile or a replacement.
	LogFileExtend bool `` /* 131-byte string literal not displayed */

	// LogFile define a list of log file configuration to allow log to files.
	LogFile OptionsFiles `json:"logFile,omitempty" yaml:"logFile,omitempty" toml:"logFile,omitempty" mapstructure:"logFile,omitempty"`

	// LogSyslogExtend define if the logFile given is in addition of default LogSyslog or a replacement.
	LogSyslogExtend bool `` /* 139-byte string literal not displayed */

	// LogSyslog define a list of syslog configuration to allow log to syslog.
	LogSyslog OptionsSyslogs `json:"logSyslog,omitempty" yaml:"logSyslog,omitempty" toml:"logSyslog,omitempty" mapstructure:"logSyslog,omitempty"`
	// contains filtered or unexported fields
}

func (*Options) Clone added in v1.11.1

func (o *Options) Clone() Options

func (*Options) Merge added in v1.11.1

func (o *Options) Merge(opt *Options)

func (*Options) Options added in v1.11.1

func (o *Options) Options() *Options

func (*Options) RegisterDefaultFunc added in v1.11.1

func (o *Options) RegisterDefaultFunc(fct FuncOpt)

RegisterDefaultFunc allow to register a function called to retrieve default options for inheritDefault. If not set, the previous options will be used as default options. To clean function, just call RegisterDefaultFunc with nil as param.

func (*Options) Validate added in v1.11.1

func (o *Options) Validate() liberr.Error

Validate allow checking if the options' struct is valid with the awaiting model

type OptionsFile added in v1.11.1

type OptionsFile struct {
	// LogLevel define the allowed level of log for this file.
	LogLevel []string `json:"logLevel,omitempty" yaml:"logLevel,omitempty" toml:"logLevel,omitempty" mapstructure:"logLevel,omitempty"`

	// Filepath define the file path for log to file.
	Filepath string `json:"filepath,omitempty" yaml:"filepath,omitempty" toml:"filepath,omitempty" mapstructure:"filepath,omitempty"`

	// Create define if the log file must exist or can create it.
	Create bool `json:"create,omitempty" yaml:"create,omitempty" toml:"create,omitempty" mapstructure:"create,omitempty"`

	// CreatePath define if the path of the log file must exist or can try to create it.
	CreatePath bool `json:"createPath,omitempty" yaml:"createPath,omitempty" toml:"createPath,omitempty" mapstructure:"createPath,omitempty"`

	// FileMode define mode to be used for the log file if the create it.
	FileMode os.FileMode `json:"fileMode,omitempty" yaml:"fileMode,omitempty" toml:"fileMode,omitempty" mapstructure:"fileMode,omitempty"`

	// PathMode define mode to be used for the path of the log file if create it.
	PathMode os.FileMode `json:"pathMode,omitempty" yaml:"pathMode,omitempty" toml:"pathMode,omitempty" mapstructure:"pathMode,omitempty"`

	// DisableStack allow to disable the goroutine id before each message.
	DisableStack bool `` /* 127-byte string literal not displayed */

	// DisableTimestamp allow to disable the timestamp before each message.
	DisableTimestamp bool `` /* 143-byte string literal not displayed */

	// EnableTrace allow to add the origin caller/file/line of each message.
	EnableTrace bool `json:"enableTrace,omitempty" yaml:"enableTrace,omitempty" toml:"enableTrace,omitempty" mapstructure:"enableTrace,omitempty"`

	// EnableAccessLog allow to add all message from api router for access log and error log.
	EnableAccessLog bool `` /* 139-byte string literal not displayed */

	// FileBufferSize define the size for buffer size (by default the buffer size is set to 32KB).
	FileBufferSize libsiz.Size `` /* 143-byte string literal not displayed */
}

func (OptionsFile) Clone added in v1.11.1

func (o OptionsFile) Clone() OptionsFile

type OptionsFiles added in v1.11.1

type OptionsFiles []OptionsFile

func (OptionsFiles) Clone added in v1.11.1

func (o OptionsFiles) Clone() OptionsFiles

type OptionsStd added in v1.11.1

type OptionsStd struct {
	// DisableStandard allow disabling to write log to standard output stdout/stderr.
	DisableStandard bool `` /* 139-byte string literal not displayed */

	// DisableStack allow to disable the goroutine id before each message.
	DisableStack bool `` /* 127-byte string literal not displayed */

	// DisableTimestamp allow to disable the timestamp before each message.
	DisableTimestamp bool `` /* 143-byte string literal not displayed */

	// EnableTrace allow to add the origin caller/file/line of each message.
	EnableTrace bool `json:"enableTrace,omitempty" yaml:"enableTrace,omitempty" toml:"enableTrace,omitempty" mapstructure:"enableTrace,omitempty"`

	// DisableColor define if color could be use or not in messages format.
	// If the running process is not a tty, no color will be used.
	DisableColor bool `` /* 127-byte string literal not displayed */

	// EnableAccessLog allow to add all message from api router for access log and error log.
	EnableAccessLog bool `` /* 139-byte string literal not displayed */
}

func (*OptionsStd) Clone added in v1.11.1

func (o *OptionsStd) Clone() *OptionsStd

type OptionsSyslog added in v1.11.1

type OptionsSyslog struct {
	// LogLevel define the allowed level of log for this syslog.
	LogLevel []string `json:"logLevel,omitempty" yaml:"logLevel,omitempty" toml:"logLevel,omitempty" mapstructure:"logLevel,omitempty"`

	// Network define the network used to connect to this syslog (tcp, udp, or any other to a local connection).
	Network string `json:"network,omitempty" yaml:"network,omitempty" toml:"network,omitempty" mapstructure:"network,omitempty"`

	// Host define the remote syslog to use.
	// If Host and Network are empty, local syslog will be used.
	Host string `json:"host,omitempty" yaml:"host,omitempty" toml:"host,omitempty" mapstructure:"host,omitempty"`
	/*
		// Severity define the severity syslog to be used.
		Severity string `json:"severity,omitempty" yaml:"severity,omitempty" toml:"severity,omitempty" mapstructure:"severity,omitempty"`
	*/
	// Facility define the facility syslog to be used.
	Facility string `json:"facility,omitempty" yaml:"facility,omitempty" toml:"facility,omitempty" mapstructure:"facility,omitempty"`

	// Tag define the syslog tag used in linux syslog system or name of logger for windows event logger.
	// For window, this value must be unic for each syslog config
	Tag string `json:"tag,omitempty" yaml:"tag,omitempty" toml:"tag,omitempty" mapstructure:"tag,omitempty"`

	// DisableStack allow to disable the goroutine id before each message.
	DisableStack bool `` /* 127-byte string literal not displayed */

	// DisableTimestamp allow to disable the timestamp before each message.
	DisableTimestamp bool `` /* 143-byte string literal not displayed */

	// EnableTrace allow to add the origin caller/file/line of each message.
	EnableTrace bool `json:"enableTrace,omitempty" yaml:"enableTrace,omitempty" toml:"enableTrace,omitempty" mapstructure:"enableTrace,omitempty"`

	// EnableAccessLog allow to add all message from api router for access log and error log.
	EnableAccessLog bool `` /* 139-byte string literal not displayed */
}

func (OptionsSyslog) Clone added in v1.11.1

func (o OptionsSyslog) Clone() OptionsSyslog

type OptionsSyslogs added in v1.11.1

type OptionsSyslogs []OptionsSyslog

func (OptionsSyslogs) Clone added in v1.11.1

func (o OptionsSyslogs) Clone() OptionsSyslogs

Jump to

Keyboard shortcuts

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