Documentation ¶
Overview ¶
Package common provides constants, variables and functions used throughout the application.
Index ¶
Constants ¶
const ( Debug = true Version = "0.0.1" AppName = "Mistwetter" TimestampFormat = "2006-01-02 15:04:05" TimestampFormatMinute = "2006-01-02 15:04" TimestampFormatSubSecond = "2006-01-02 15:04:05.0000 MST" TimestampFormatDate = "2006-01-02" HeartBeat = time.Millisecond * 500 RCTimeout = time.Millisecond * 10 )
Debug indicates whether to emit additional log messages and perform additional sanity checks. Version is the version number to display. AppName is the name of the application. TimestampFormat is the format string used to render datetime values. HeartBeat is the interval for worker goroutines to wake up and check their status.
const MinLogLevel = "TRACE"
Variables ¶
var ( BaseDir = filepath.Join(os.Getenv("HOME"), fmt.Sprintf("%s.d", strings.ToLower(AppName))) LogPath = filepath.Join(BaseDir, fmt.Sprintf("%s.log", strings.ToLower(AppName))) DbPath = filepath.Join(BaseDir, fmt.Sprintf("%s.db", strings.ToLower(AppName))) )
BaseDir is the folder where all application-specific files (database, log files, etc) are stored. LogPath is the file to the log path. DbPath is the path of the main database. HostCachePath is the path to the IP cache. XfrDbgPath is the path of the folder where data on DNS zone transfers are stored.
var LogLevels = []logutils.LogLevel{
"TRACE",
"DEBUG",
"INFO",
"WARN",
"ERROR",
"CRITICAL",
"CANTHAPPEN",
"SILENT",
}
LogLevels are the names of the log levels supported by the logger.
PackageLevels defines minimum log levels per package.
Functions ¶
func GetChecksum ¶
GetChecksum computes the SHA512 checksum of the given data.
func GetLogger ¶
GetLogger Tries to create a named logger instance and return it. If the directory to hold the log file does not exist, try to create it.
func InitApp ¶
func InitApp() error
InitApp performs some basic preparations for the application to run. Currently, this means creating the BASE_DIR folder.
func SetBaseDir ¶
SetBaseDir sets the BaseDir and related variables.
Types ¶
This section is empty.