utils

package
v0.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LoggerMiddlewareConfig = middleware.RequestLoggerConfig{
	LogLatency:       true,
	LogRemoteIP:      true,
	LogHost:          true,
	LogMethod:        true,
	LogURI:           true,
	LogStatus:        true,
	LogError:         true,
	LogResponseSize:  true,
	LogContentLength: true,
	LogValuesFunc: func(c echo.Context, v middleware.RequestLoggerValues) error {
		email := "unauthenticated"
		if e := c.Get("user_email"); e != nil {
			email, _ = e.(string)
		}
		log.WithFields(log.Fields{
			"time":          time.Now().Format(time.RFC3339Nano),
			"remote_ip":     v.RemoteIP,
			"host":          v.Host,
			"method":        v.Method,
			"uri":           v.URI,
			"status":        v.Status,
			"error":         v.Error,
			"latency":       v.Latency.Nanoseconds() / 1000,
			"latency_human": v.Latency,
			"bytes_in":      v.ContentLength,
			"bytes_out":     v.ResponseSize,
			"email":         email,
		}).Info("request")
		return nil
	},
}

Functions

func InvalidateSession added in v0.8.0

func InvalidateSession(c echo.Context, sessionCookie string) error

InvalidateSession clears the session data and sets the session cookie to expire immediately.

func RemoveSessionCookie added in v0.8.0

func RemoveSessionCookie(c echo.Context, sessionCookie string) error

RemoveSessionCookie manually removes the session cookie from the response. This is useful when the session does not exist server-side, but client-side cookies still exist

Types

type ManualSyncStatus

type ManualSyncStatus string
const (
	ManualSyncNone      ManualSyncStatus = "none"
	ManualSyncAnnotated ManualSyncStatus = "annotated"
	ManualSyncPending   ManualSyncStatus = "pending"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL