func addLog(w http.ResponseWriter, r *http.Request, t auth.Token) error {
	a, err := app.GetByName(r.URL.Query().Get(":app"))
	if err != nil {
		return err
	}
	if t.GetAppName() != app.InternalAppName {
		allowed := permission.Check(t, permission.PermAppUpdateLog,
			contextsForApp(a)...,
		)
		if !allowed {
			return permission.ErrUnauthorized
		}
	}
	logs, _ := InputValues(r, "message")
	source := InputValue(r, "source")
	if source == "" {
		source = "app"
	}
	unit := InputValue(r, "unit")
	for _, log := range logs {
		err := a.Log(log, source, unit)
		if err != nil {
			return err
		}
	}
	return nil
}
func addLog(w http.ResponseWriter, r *http.Request, t auth.Token) error {
	a, err := app.GetByName(r.URL.Query().Get(":app"))
	if err != nil {
		return err
	}
	if t.GetAppName() != app.InternalAppName {
		allowed := permission.Check(t, permission.PermAppUpdateLog,
			contextsForApp(a)...,
		)
		if !allowed {
			return permission.ErrUnauthorized
		}
	}
	logs, _ := InputValues(r, "message")
	source := InputValue(r, "source")
	if source == "" {
		source = "app"
	}
	unit := InputValue(r, "unit")
	for _, log := range logs {
		err := a.Log(log, source, unit)
		if err != nil {
			return err
		}
	}
	return nil
}
func addLog ( w http . ResponseWriter , r * http . Request , t auth . Token ) error { a , err := app . GetByName ( r . URL . Query ( ) . Get ( " " ) ) if err != nil { return err } if t . GetAppName ( ) != app . InternalAppName { allowed := permission . Check ( t , permission . PermAppUpdateLog , contextsForApp ( a ) ... , ) if ! allowed { return permission . ErrUnauthorized } } logs , _ := InputValues ( r , " " ) source := InputValue ( r , " " ) if source == " " { source = " " } unit := InputValue ( r , " " ) for _ , log := range logs { err := a . Log ( log , source , unit ) if err != nil { return err } } return nil }
// title: app log
// path: /apps/{app}/log
// method: POST
// consume: application/x-www-form-urlencoded
// responses:
//   200: Ok
//   400: Invalid data
//   401: Unauthorized
//   404: App not found
title : app log path : / apps / { app } / log method : POST consume : application / x - www - form - urlencoded responses : 200 : Ok 400 : Invalid data 401 : Unauthorized 404 : App not found