Beispiel #1
0
func (this *SimpleFormater) Format(level int, msg []byte) []byte {
	lm, ok := logLevels[level]
	if !ok {
		lm = "-"
	}
	return misc.AppendBytes(
		[]byte("["),
		[]byte(lm),
		[]byte("]\t"),
		[]byte("["),
		[]byte(time.Now().Format(misc.TimeGeneralLayout())),
		[]byte("]\t"),
		msg,
		[]byte("\n"),
	)
}
Beispiel #2
0
func RunCmd(cmdStr string) *ShellResult {
	result := &ShellResult{
		Ok: true,
	}

	var err error

	cmd := NewCmd(cmdStr)
	result.Output, err = cmd.CombinedOutput()

	if err != nil {
		result.Ok = false
		result.Output = misc.AppendBytes(result.Output, []byte(err.Error()))
	}
	return result
}
Beispiel #3
0
func afterAction(context *controller.Context, args []string) {
	context.RespBody = misc.AppendBytes(context.RespBody, []byte("after "+args[0]+"\n"))

	context.TransData["after"] = "after"
}
Beispiel #4
0
func regexAction(context *controller.Context, args []string) {
	context.RespBody = misc.AppendBytes(context.RespBody, []byte(" regex id = "+args[0]+" "))
}
Beispiel #5
0
func exactAction(context *controller.Context, args []string) {
	context.RespBody = misc.AppendBytes(context.RespBody, []byte(" exact "))
}
Beispiel #6
0
func afterAction(context *controller.Context, args []string) {
	context.RespBody = misc.AppendBytes(context.RespBody, []byte("after\n"))
}