Documentation
¶
Index ¶
- Constants
- Variables
- func AppData(filepaths ...string) string
- func Bye()
- func Config(filepaths ...string) string
- func Constants(filepaths ...string) string
- func DebugPrintln(args ...interface{})
- func DelWarning(module string)
- func GetStackLines(from int, to int) []string
- func HasWarning() bool
- func InitModulesOrderByName()
- func InitOrderByName(module string)
- func LogError(err error)
- func Must(err error)
- func MustGetWD() string
- func MustLoadRegisteredFolders()
- func Quit()
- func Recover(args ...interface{})
- func RegisterDataFolder(folder ...string) string
- func RegisterInitiator(module string, Name string, handler func())
- func Resource(filepaths ...string) string
- func SetConfigPath(paths ...string)
- func SetWarning(module string, info ...string)
- func System(filepaths ...string) string
- func WaitingQuit()
- func Warnings() map[string][]string
- type Module
Constants ¶
View Source
const EnvForceDebugMode = "HerbDebug"
EnvForceDebugMode env field to set force demog mode
View Source
const EnvRootPath = "HerbRoot"
EnvRootPath env field to set root path
Variables ¶
View Source
var AppDataPath string
View Source
var ConfigPath string
View Source
var ConstantsPath string
View Source
var Debug = false
View Source
var DefaultFolderMode = os.FileMode(0700)
View Source
var ForceDebug bool
ForceDebug force useing debug mode
View Source
var IgnoreEnv = false
IgnoreEnv ignore os env settings.
View Source
var Initiators = map[string]modulelist{}
View Source
var IsErrorIgnored = func(err error) bool { for k := range LoggerIgnoredErrorsChecker { if LoggerIgnoredErrorsChecker[k](err) { return true } } return false }
View Source
var LeaveMessage = "Bye."
View Source
var LoggerIgnoredErrorsChecker = []func(error) bool{ func(err error) bool { oe, ok := err.(*net.OpError) if ok { if oe.Err == syscall.EPIPE || oe.Err == syscall.ECONNRESET { return true } se, ok := oe.Err.(*os.SyscallError) if ok && (se.Err == syscall.EPIPE || se.Err == syscall.ECONNRESET) { return true } } return false }, }
View Source
var LoggerMaxLength = 5
View Source
var Modules = modulelist{}
View Source
var MustChRoot = func() { Must(os.Chdir(RootPath)) }
View Source
var QuitChan = make(chan int)
View Source
var RegisterLoggerIgnoredErrorsChecker = func(f func(error) bool) { LoggerIgnoredErrorsChecker = append(LoggerIgnoredErrorsChecker, f) }
View Source
var ResouresPath string
View Source
var RootPath string
View Source
var SignalChan = make(chan os.Signal)
View Source
var SystemPath string
View Source
var UpdatePaths = func() error { if RootPath == "" { RootPath = filepath.Join(filepath.Dir(mustPath(os.Executable())), "../") } ResouresPath = path.Join(RootPath, "resources") AppDataPath = path.Join(RootPath, "appdata") ConfigPath = path.Join(RootPath, "config") SystemPath = path.Join(RootPath, "system") ConstantsPath = path.Join(RootPath, "system", "constants") return nil }
Functions ¶
func DebugPrintln ¶
func DebugPrintln(args ...interface{})
func DelWarning ¶
func DelWarning(module string)
func GetStackLines ¶
func HasWarning ¶
func HasWarning() bool
func InitModulesOrderByName ¶
func InitModulesOrderByName()
func InitOrderByName ¶
func InitOrderByName(module string)
func MustLoadRegisteredFolders ¶
func MustLoadRegisteredFolders()
func RegisterDataFolder ¶
func RegisterInitiator ¶
func SetConfigPath ¶
func SetConfigPath(paths ...string)
func SetWarning ¶
func WaitingQuit ¶
func WaitingQuit()
Types ¶
Click to show internal directories.
Click to hide internal directories.