1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-20 03:17:04 +00:00

add accesslog+MVC example

This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-09-17 18:01:35 +03:00
parent 0c125baf2a
commit 7fa2666f58
4 changed files with 46 additions and 15 deletions

View File

@@ -31,6 +31,9 @@ const (
// GetFields returns the accesslog fields for this request.
// Returns a store which the caller can use to
// set/get/remove custom log fields. Use its `Set` method.
//
// To use with MVC: Register(accesslog.GetFields).
// DI Handlers: ConfigureContainer().RegisterDependency(accesslog.GetFields).
func GetFields(ctx *context.Context) (fields *Fields) {
if v := ctx.Values().Get(fieldsContextKey); v != nil {
fields = v.(*Fields)
@@ -60,7 +63,6 @@ func shouldSkip(ctx *context.Context) bool {
}
type (
// Fields is a type alias for memstore.Store, used to set
// more than one field at serve-time. Same as FieldExtractor.
Fields = memstore.Store