app/history/helper.go

53 lines
796 B
Go

package history
import "kumoly.io/kumoly/app/util"
func Error() *History {
h := getBase()
h.Type = ERROR
if !PROD {
h.Trace = util.Stack()
}
return h
}
func Info() *History {
h := getBase()
h.Type = INFO
return h
}
func getBase() *History {
mod, file := util.CallerMod(3)
h := &History{
Module: mod,
Caller: file,
}
return h
}
func (h *History) Nm(name string) *History {
h.Name = name
return h
}
func (h *History) Msg(msg string) *History {
h.Message = msg
return h
}
func (h *History) Bd(body interface{}) *History {
h.Body = body
return h
}
func (h *History) Iss(issuer string) *History {
h.Issuer = issuer
return h
}
func (h *History) Grp(grp string) *History {
h.Group = grp
return h
}
func (h *History) Scp(sco string) *History {
h.Scope = sco
return h
}