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"), ) }
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 }
func afterAction(context *controller.Context, args []string) { context.RespBody = misc.AppendBytes(context.RespBody, []byte("after "+args[0]+"\n")) context.TransData["after"] = "after" }
func regexAction(context *controller.Context, args []string) { context.RespBody = misc.AppendBytes(context.RespBody, []byte(" regex id = "+args[0]+" ")) }
func exactAction(context *controller.Context, args []string) { context.RespBody = misc.AppendBytes(context.RespBody, []byte(" exact ")) }
func afterAction(context *controller.Context, args []string) { context.RespBody = misc.AppendBytes(context.RespBody, []byte("after\n")) }