コード例 #1
0
ファイル: formater.go プロジェクト: Andals/gobox
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"),
	)
}
コード例 #2
0
ファイル: shell.go プロジェクト: Andals/gobox
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
}
コード例 #3
0
ファイル: main.go プロジェクト: Andals/gobox
func afterAction(context *controller.Context, args []string) {
	context.RespBody = misc.AppendBytes(context.RespBody, []byte("after "+args[0]+"\n"))

	context.TransData["after"] = "after"
}
コード例 #4
0
ファイル: main.go プロジェクト: Andals/gobox
func regexAction(context *controller.Context, args []string) {
	context.RespBody = misc.AppendBytes(context.RespBody, []byte(" regex id = "+args[0]+" "))
}
コード例 #5
0
ファイル: main.go プロジェクト: Andals/gobox
func exactAction(context *controller.Context, args []string) {
	context.RespBody = misc.AppendBytes(context.RespBody, []byte(" exact "))
}
コード例 #6
0
ファイル: main.go プロジェクト: Andals/gpm
func afterAction(context *controller.Context, args []string) {
	context.RespBody = misc.AppendBytes(context.RespBody, []byte("after\n"))
}