report - ActiveState ActiveGo 1.8

Package report

import ""

Overview ▾

Package report organizes textual reporting from the HTTP context.

func JSON

func JSON(writer io.Writer, next http.Handler) http.Handler

JSON writes a JSON encoded Event to the provided writer at the completion of each request

func JSONMiddleware

func JSONMiddleware(writer io.Writer) func(http.Handler) http.Handler

JSONMiddleware returns a composable handler factory implementing the JSON handler.

type Event

Event contains significant fields from the request or response to report

type Event struct {
    Time           time.Time `json:"time,omitempty"`
    Method         string    `json:"method,omitempty"`
    Url            string    `json:"url,omitempty"`
    Path           string    `json:"path,omitempty"`
    Proto          string    `json:"proto,omitempty"`
    Status         int       `json:"status,omitempty"`
    Ms             int       `json:"ms"`
    Size           int64     `json:"size"`
    RemoteAddr     string    `json:"remote_addr,omitempty"`
    ForwardedFor   string    `json:"forwarded_for,omitempty"`
    ForwardedProto string    `json:"forwarded_proto,omitempty"`
    Range          string    `json:"range,omitempty"`
    Host           string    `json:"host,omitempty"`
    Referrer       string    `json:"referrer,omitempty"`
    UserAgent      string    `json:"user_agent,omitempty"`
    Authorization  string    `json:"authorization,omitempty"`
    Region         string    `json:"region,omitempty"`
    Country        string    `json:"country,omitempty"`
    City           string    `json:"city,omitempty"`
    RequestId      string    `json:"request_id,omitempty"`