common

package
v0.0.0-...-fda4d97 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2020 License: Apache-2.0 Imports: 10 Imported by: 4

Documentation

Overview

Package common contains many useful functions for logging, config, etc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompatibleLog

func CompatibleLog(conf *Config) string

CompatibleLog for making log_file and log_dir compatible

func GetFileNameDayAndOldDay

func GetFileNameDayAndOldDay(conf *Config, prefix string) (string, string)

GetFileNameDayAndOldDay get name of new file and old file

func GetLastNum

func GetLastNum(str string, split string) int

GetLastNum get file name number suffix

func Hostname

func Hostname(conf *Config) string

Hostname get current hostname

func MyNewLogger

func MyNewLogger(conf *Config, logFile string) *logs.BeeLogger

MyNewLogger constructor of needed logger

func NewMySQLConnection

func NewMySQLConnection(conf *Config) (mysql.Conn, error)

NewMySQLConnection the constructor of mysql connecting

Types

type BaseConf

type BaseConf struct {
	BaseDir      string
	SnapshotDir  string
	SnapshotDay  int
	LogDir       string
	Endpoint     string
	LogFile      string
	LogLevel     int
	FalconClient string
	IgnoreFile   string
}

BaseConf config about dir, log, etc.

type Config

type Config struct {
	Base     BaseConf
	DataBase DatabaseConf
}

Config for initializing. This can be loaded from TOML file with -c

func NewConfig

func NewConfig(file string) (*Config, error)

NewConfig the constructor of config

type DatabaseConf

type DatabaseConf struct {
	User     string
	Password string
	Host     string
	Port     int
}

DatabaseConf config about database

Jump to

Keyboard shortcuts

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