variadic for fatal method

This commit is contained in:
alessio 2016-12-16 23:53:27 +01:00
parent b13b91a5e5
commit 249dca4dfb
2 changed files with 6 additions and 7 deletions

View File

@ -1,4 +1,3 @@
// +build !windows
package settings
@ -12,6 +11,6 @@ func (s *Settings) Flimit() {
rLimit.Cur = s.Config.Flimit
err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rLimit)
if err != nil {
s.Fatal("Error Setting Rlimit", err)
s.Fatal(err, "Error setting rlimit")
}
}

View File

@ -14,14 +14,14 @@ func (s Settings) Wdir() string {
func (s Settings) Validate(err error) error {
if err != nil {
s.Fatal("", err)
s.Fatal(err, "")
}
return nil
}
func (s Settings) Fatal(msg string, err error) {
if msg != "" {
log.Fatal(s.Red.Regular(msg), err.Error())
func (s Settings) Fatal(err error, msg ...interface{}) {
if len(msg) > 0 {
log.Fatalln(s.Red.Regular(msg...), err.Error())
}
log.Fatal(err.Error())
log.Fatalln(err.Error())
}