Versions in this module Expand all Collapse all v1 v1.0.0 Jan 29, 2021 Changes in this version + const DLTagHTTPFailed + const DLTagHTTPSuccess + const DLTagMySqlFailed + const DLTagMySqlSuccess + const DLTagRedisFailed + const DLTagRedisSuccess + const DLTagRequestIn + const DLTagRequestOut + const DLTagTCPFailed + const DLTagThriftFailed + const DLTagThriftSuccess + const DLTagUndefind + var ConfEnv string + var ConfEnvPath string + var DBDefaultPool *sql.DB + var DBMapPool map[string]*sql.DB + var DateFormat = "2006-01-02" + var GORMDefaultPool *gorm.DB + var GORMMapPool map[string]*gorm.DB + var LocalIP = net.ParseIP("127.0.0.1") + var TimeFormat = "2006-01-02 15:04:05" + var TimeLocation *time.Location + var ViperConfMap map[string]*viper.Viper + func AddGetDataToUrl(urlString string, data url.Values) string + func CloseDB() error + func CreateBizDLTag(tagName string) string + func DBPoolLogQuery(trace *TraceContext, sqlDb *sql.DB, query string, args ...interface{}) (*sql.Rows, error) + func Destroy() + func Encode(data string) (string, error) + func GetBoolConf(key string) bool + func GetConf(key string) interface + func GetConfEnv() string + func GetConfFilePath(fileName string) string + func GetConfPath(fileName string) string + func GetDBPool(name string) (*sql.DB, error) + func GetDurationConf(key string) time.Duration + func GetFloat64Conf(key string) float64 + func GetGormPool(name string) (*gorm.DB, error) + func GetIntConf(key string) int + func GetLocalIPs() (ips []net.IP) + func GetMd5Hash(text string) string + func GetStringConf(key string) string + func GetStringMapConf(key string) map[string]interface + func GetStringMapStringConf(key string) map[string]string + func GetStringSliceConf(key string) []string + func GetTimeConf(key string) time.Time + func GetTraceId() (traceId string) + func HttpGET(trace *TraceContext, urlString string, urlParams url.Values, msTimeout int, ...) (*http.Response, []byte, error) + func HttpJSON(trace *TraceContext, urlString string, jsonContent string, msTimeout int, ...) (*http.Response, []byte, error) + func HttpPOST(trace *TraceContext, urlString string, urlParams url.Values, msTimeout int, ...) (*http.Response, []byte, error) + func InArrayString(s string, arr []string) bool + func Init(configPath string) error + func InitBaseConf(path string) error + func InitDBPool(path string) error + func InitModule(configPath string, modules []string) error + func InitRedisConf(path string) error + func InitViperConf() error + func IsSetConf(key string) bool + func NewSpanId() string + func ParseConfPath(config string) error + func ParseConfig(path string, conf interface{}) error + func ParseLocalConfig(fileName string, st interface{}) error + func ParseServerAddr(serverAddr string) (host, port string) + func RedisConfDo(trace *TraceContext, name string, commandName string, args ...interface{}) (interface{}, error) + func RedisConnFactory(name string) (redis.Conn, error) + func RedisLogDo(trace *TraceContext, c redis.Conn, commandName string, args ...interface{}) (interface{}, error) + func Substr(str string, start int64, end int64) string + type BaseConf struct + Base struct{ ... } + DebugMode string + Log LogConfig + TimeLocation string + var ConfBase *BaseConf + func GetBaseConf() *BaseConf + type LogConfConsoleWriter struct + Color bool + On bool + type LogConfFileWriter struct + LogPath string + On bool + RotateLogPath string + RotateWfLogPath string + WfLogPath string + type LogConfig struct + CW LogConfConsoleWriter + FW LogConfFileWriter + Level string + type Logger struct + var Log *Logger + func (l *Logger) Close() + func (l *Logger) TagDebug(trace *TraceContext, dltag string, m map[string]interface{}) + func (l *Logger) TagError(trace *TraceContext, dltag string, m map[string]interface{}) + func (l *Logger) TagInfo(trace *TraceContext, dltag string, m map[string]interface{}) + func (l *Logger) TagTrace(trace *TraceContext, dltag string, m map[string]interface{}) + func (l *Logger) TagWarn(trace *TraceContext, dltag string, m map[string]interface{}) + type MySQLConf struct + DataSourceName string + DriverName string + MaxConnLifeTime int + MaxIdleConn int + MaxOpenConn int + type MysqlGormLogger struct + Trace *TraceContext + func (logger *MysqlGormLogger) CtxPrint(s *gorm.DB, values ...interface{}) + func (logger *MysqlGormLogger) LogFormatter(values ...interface{}) (messages map[string]interface{}) + func (logger *MysqlGormLogger) NowFunc() time.Time + func (logger *MysqlGormLogger) Print(values ...interface{}) + type MysqlMapConf struct + List map[string]*MySQLConf + type RedisConf struct + ConnTimeout int + Db int + Password string + ProxyList []string + ReadTimeout int + WriteTimeout int + var ConfRedis *RedisConf + type RedisMapConf struct + List map[string]*RedisConf + var ConfRedisMap *RedisMapConf + type Trace struct + Caller string + HintCode int64 + HintContent string + SpanId string + SrcMethod string + TraceId string + type TraceContext struct + CSpanId string + func NewTrace() *TraceContext