Documentation
¶
Overview ¶
日志相关配置
Index ¶
Constants ¶
View Source
const ( DefaultAppName = "application" DefaultServerType = "backend" DefaultPort = 9445 )
Variables ¶
This section is empty.
Functions ¶
func LoadGlobalConfig ¶
Types ¶
type Discovery ¶
type Discovery struct {
Namespace string `toml:"namespace" json:"namespace" env:"DISCOVERY_NAMESPACE"` // 命名空间
Endpoints []string `toml:"endpoints" json:"endpoints" env:"DISCOVERY_ENDPOINTS"` // 连接端点
DialTimeout utils.Duration `toml:"dial_timeout" json:"dial_timeout" env:"DISCOVERY_DIALTIMEOUT"` // 连接超时时间
}
func (Discovery) DefaultConfig ¶
type GinConfig ¶
type GinConfig struct {
App string `toml:"app" json:"app" env:"GIN_APP"` // application
ServerType string `toml:"server_type" json:"server_type" env:"GIN_SERVERTYPE"` // 服务类型
EnablePprof bool `toml:"enable_pprof" json:"enable_pprof" env:"GIN_ENABLEPPROF"` // pprof开关
EnableHealth bool `toml:"enable_health" json:"enable_health" env:"GIN_ENABLEHEALTH"` // health开关
EnableDebug bool `toml:"enable_debug" json:"enable_debug" env:"GIN_ENABLEDEBUG"` // debug开关
EnableMetrics bool `toml:"enable_metrics" json:"enable_metrics" env:"GIN_ENABLEMETRICS"` // metrics开关
EnableCache bool `toml:"enable_cache" json:"enable_cache" env:"GIN_ENABLECACHE"` // 缓存开关
EnableAuth bool `toml:"enable_auth" json:"enable_auth" env:"GIN_ENABLEAUTH"` // 签名权限开关
EnableVerifyCommand bool `toml:"enable_verify_command" json:"enable_verify_command" env:"GIN_VERIFYCOMMAND"` // 指令验证开关
Port int `toml:"port" json:"port" env:"GIN_PORT"` // port
Trace string `toml:"trace" json:"trace" env:"GIN_TRACE"` // Trace
GracefulTimeout utils.Duration `toml:"graceful_timeout" json:"graceful_timeout" env:"GIN_GRACEFULTIMEOUT"` // GracefulTimeout
}
func (GinConfig) DefaultConfig ¶
func (GinConfig) ListenAddr ¶
type Global ¶
type Global struct {
Logging `toml:"logging"`
Metrics `toml:"metrics"`
Discovery `toml:"discovery"`
GinConfig `toml:"gin"`
RateLimit `toml:"ratelimit"`
Temporary `toml:"temporary"`
}
var GlobalCfg Global
type Logging ¶
type Logging struct {
IsTerminal bool `toml:"isterminal" json:"isterminal" env:"LOGGING_ISTERMINAL"` //debug模式stdout输出
Dir string `toml:"dir" json:"dir" env:"LOGGING_DIR"` //日志目录
Filename string `toml:"name" json:"name" env:"LOGGING_FILENAME"` //日志名称
Level string `toml:"level" json:"level" env:"LOGGING_LEVEL"` //打印日志等级
MaxSize uint16 `toml:"maxsize" json:"maxsize" env:"LOGGING_MAXSIZE"` //单日志尺寸
MaxBackups uint16 `toml:"maxbackups" json:"maxbackups" env:"LOGGING_MAXBACKUPS"` //日志备份数
MaxAge uint16 `toml:"maxage" json:"maxage" env:"LOGGING_MAXAGE"` //留旧日志文件的最大天数
}
Logging represents a logging configuration
func (Logging) DefaultConfig ¶
type Metrics ¶
type Metrics struct {
FlushInterval time.Duration `toml:"flush_interval" json:"flush_interval" env:"METRICS_FLUSHINTERVAL"` // flush时间周期
EnableGoRuntimeMetrics bool `toml:"enable_goruntime_metrics" json:"enable_goruntime_metrics" env:"METRICS_ENABLEGORUNTIMEMETRICS"` // 是否收集goroutine相关信息
MetricsPrefix string `toml:"metrics_prefix" json:"metrics_prefix" env:"METRICS_METRICSPREFIX"` // 自定义metric指标前缀
MetricsTags map[string]string `toml:"metrics_tags" json:"metrics_tags" env:"METRICS_METRICSTAGS"` // 自定义metric自动填充kv数据
}
Metrics represents a logging configuration
func (Metrics) DefaultConfig ¶
type RateLimit ¶
type RateLimit struct {
QPS int `toml:"qps" json:"qps" env:"GIN_RATELIMIT_QPS"` // qps
Burst int `toml:"burst" json:"burst" env:"GIN_RATELIMIT_BURST"` // 并发数
}
func (RateLimit) DefaultConfig ¶
type Temporary ¶
type Temporary struct {
MaxBufferSize int64 `toml:"max_buffer_size" json:"max_buffer_size" env:"TEMPORARY_MAX_BUFFER_SIZE"` // 最大使用内存空间, 超过时则转化成文件
FileDir string `toml:"file_dir" json:"file_dir" env:"TEMPORARY_FILE_DIR"` // 临时文件目录
FilePattern string `toml:"file_pattern" json:"file_pattern" env:"TEMPORARY_FILE_PATTERN"` // 临时文件名格式
MaxUploadSize int64 `toml:"max_upload_size" json:"max_upload_size" env:"TEMPORARY_MAX_UPLOAD_SIZE"` // 最大上传文件大小
}
Temporary represents a logging configuration
func (Temporary) DefaultConfig ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.