本文整理汇总了Golang中github.com/goadesign/goa.Service.LogInfo方法的典型用法代码示例。如果您正苦于以下问题:Golang Service.LogInfo方法的具体用法?Golang Service.LogInfo怎么用?Golang Service.LogInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/goadesign/goa.Service
的用法示例。
在下文中一共展示了Service.LogInfo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: MountAeController
// MountAeController "mounts" a Ae resource controller on the given service.
func MountAeController(service *goa.Service, ctrl AeController) {
initService(service)
var h goa.Handler
h = func(ctx context.Context, rw http.ResponseWriter, req *http.Request) error {
// Check if there was an error loading the request
if err := goa.ContextError(ctx); err != nil {
return err
}
// Build the context
rctx, err := NewHealthAeContext(ctx, service)
if err != nil {
return err
}
return ctrl.Health(rctx)
}
service.Mux.Handle("GET", "/_ah/health", ctrl.MuxHandler("Health", h, nil))
service.LogInfo("mount", "ctrl", "Ae", "action", "Health", "route", "GET /_ah/health")
h = func(ctx context.Context, rw http.ResponseWriter, req *http.Request) error {
// Check if there was an error loading the request
if err := goa.ContextError(ctx); err != nil {
return err
}
// Build the context
rctx, err := NewStartAeContext(ctx, service)
if err != nil {
return err
}
return ctrl.Start(rctx)
}
service.Mux.Handle("GET", "/_ah/start", ctrl.MuxHandler("Start", h, nil))
service.LogInfo("mount", "ctrl", "Ae", "action", "Start", "route", "GET /_ah/start")
}
示例2: MountSpecController
// MountSpecController "mounts" a Spec resource controller on the given service.
func MountSpecController(service *goa.Service, ctrl SpecController) {
initService(service)
var h goa.Handler
service.Mux.Handle("OPTIONS", "/swagger/spec", ctrl.MuxHandler("preflight", handleSpecOrigin(cors.HandlePreflight()), nil))
h = func(ctx context.Context, rw http.ResponseWriter, req *http.Request) error {
// Check if there was an error loading the request
if err := goa.ContextError(ctx); err != nil {
return err
}
// Build the context
rctx, err := NewShowSpecContext(ctx, service)
if err != nil {
return err
}
return ctrl.Show(rctx)
}
h = handleSpecOrigin(h)
service.Mux.Handle("GET", "/swagger/spec", ctrl.MuxHandler("Show", h, nil))
service.LogInfo("mount", "ctrl", "Spec", "action", "Show", "route", "GET /swagger/spec")
}
示例3: MountBottleController
// MountBottleController "mounts" a Bottle resource controller on the given service.
func MountBottleController(service *goa.Service, ctrl BottleController) {
initService(service)
var h goa.Handler
h = func(ctx context.Context, rw http.ResponseWriter, req *http.Request) error {
// Check if there was an error loading the request
if err := goa.ContextError(ctx); err != nil {
return err
}
// Build the context
rctx, err := NewCreateBottleContext(ctx, service)
if err != nil {
return err
}
// Build the payload
if rawPayload := goa.ContextRequest(ctx).Payload; rawPayload != nil {
rctx.Payload = rawPayload.(*CreateBottlePayload)
} else {
return goa.MissingPayloadError()
}
return ctrl.Create(rctx)
}
service.Mux.Handle("POST", "/bottles", ctrl.MuxHandler("Create", h, unmarshalCreateBottlePayload))
service.LogInfo("mount", "ctrl", "Bottle", "action", "Create", "route", "POST /bottles")
h = func(ctx context.Context, rw http.ResponseWriter, req *http.Request) error {
// Check if there was an error loading the request
if err := goa.ContextError(ctx); err != nil {
return err
}
// Build the context
rctx, err := NewShowBottleContext(ctx, service)
if err != nil {
return err
}
return ctrl.Show(rctx)
}
service.Mux.Handle("GET", "/bottles/:id", ctrl.MuxHandler("Show", h, nil))
service.LogInfo("mount", "ctrl", "Bottle", "action", "Show", "route", "GET /bottles/:id")
}
示例4: MountSwaggerController
// MountSwaggerController "mounts" a Swagger resource controller on the given service.
func MountSwaggerController(service *goa.Service, ctrl SwaggerController) {
initService(service)
var h goa.Handler
h = ctrl.FileHandler("/swagger-ui/*filepath", "swagger-ui/")
service.Mux.Handle("GET", "/swagger-ui/*filepath", ctrl.MuxHandler("serve", h, nil))
service.LogInfo("mount", "ctrl", "Swagger", "files", "swagger-ui/", "route", "GET /swagger-ui/*filepath")
h = ctrl.FileHandler("/swagger.json", "swagger/swagger.json")
service.Mux.Handle("GET", "/swagger.json", ctrl.MuxHandler("serve", h, nil))
service.LogInfo("mount", "ctrl", "Swagger", "files", "swagger/swagger.json", "route", "GET /swagger.json")
h = ctrl.FileHandler("/swagger-ui/", "swagger-ui/index.html")
service.Mux.Handle("GET", "/swagger-ui/", ctrl.MuxHandler("serve", h, nil))
service.LogInfo("mount", "ctrl", "Swagger", "files", "swagger-ui/index.html", "route", "GET /swagger-ui/")
}