Documentation ¶
Overview ¶
Package common contains many useful functions for logging, config, etc.
Index ¶
- func CompatibleLog(conf *Config) string
- func GetFileNameDayAndOldDay(conf *DatabaseConf, prefix string) (string, string)
- func GetLastNum(str string, split string) int
- func Hostname(conf *DatabaseConf) string
- func MyNewLogger(conf *Config, logFile string) *logs.BeeLogger
- type BaseConf
- type Config
- type DatabaseConf
- type DbConn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompatibleLog ¶
CompatibleLog for making log_file and log_dir compatible
func GetFileNameDayAndOldDay ¶
func GetFileNameDayAndOldDay(conf *DatabaseConf, prefix string) (string, string)
GetFileNameDayAndOldDay get name of new file and old file
func GetLastNum ¶
GetLastNum get file name number suffix
Types ¶
type BaseConf ¶
type BaseConf struct { BaseDir string `toml:"basedir"` SnapshotDir string `toml:"snapshot_dir"` SnapshotDay int `toml:"snapshot_day"` LogDir string `toml:"log_dir"` LogFile string `toml:"log_file"` LogLevel int `toml:"log_level"` FalconClient string `toml:"falcon_client"` IgnoreFile string `toml:"ignore_file"` }
BaseConf config about dir, log, etc.
type Config ¶
type Config struct { Base BaseConf `toml:"default"` Mysql []DatabaseConf `toml:"mysql"` }
Config for initializing. This can be loaded from TOML file with -c
type DatabaseConf ¶
type DatabaseConf struct { User string `toml:"user"` Password string `toml:"password"` Host string `toml:"host"` Port int `toml:"port"` Endpoint string `toml:"endpoint"` }
DatabaseConf config about database
type DbConn ¶
func NewMySQLConnection ¶
func NewMySQLConnection(conf DatabaseConf) (*DbConn, error)
NewMySQLConnection the constructor of mysql connecting
func (DbConn) HealthCheck ¶
func (dbConn DbConn) HealthCheck()
Click to show internal directories.
Click to hide internal directories.