func logRequest(status int, host string, conn *http.Conn) { var ip string splitPoint := strings.LastIndex(conn.RemoteAddr, ":") if splitPoint == -1 { ip = conn.RemoteAddr } else { ip = conn.RemoteAddr[0:splitPoint] } request := conn.Req logging.Info("fe", status, request.Method, host, request.RawURL, ip, request.UserAgent, request.Referer) }
func runProcess(amp, cmd, path, config string, console bool, quit chan bool) { var files []*os.File if console { files = []*os.File{nil, os.Stdout, os.Stderr} } else { files = []*os.File{nil, nil, nil} } logging.Info("Running: amp %s %s", cmd, config) process, err := os.StartProcess( amp, []string{"amp", cmd, config}, &os.ProcAttr{ Dir: path, Env: os.Environ(), Files: files, }) if err != nil { runtime.StandardError(err) } waitmsg, err := process.Wait(0) if err != nil { runtime.StandardError(err) } if waitmsg.ExitStatus() != 0 { runtime.Error("ERROR: Got %s when running `amp %s %s`\n", waitmsg, cmd, config) } quit <- true }