httplog

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2023 License: MIT Imports: 4 Imported by: 2

README

httplog

release license PRs Welcome

HTTP logger for Golang's net/http

Installation

go get -u github.com/dundunlabs/httplog

Usage

package main

import (
	"net/http"

	"github.com/dundunlabs/httplog"
)

func main() {
	handler := httplog.NewHandler(http.DefaultServeMux)
	http.ListenAndServe(":8080", handler)
}

License

MIT


Enjoy your coding 🚀

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Handler

type Handler struct {
	Handler  http.Handler
	PathSize int
}

func NewHandler

func NewHandler(handler http.Handler, options ...HanlderOptions) Handler

func (Handler) ServeHTTP

func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type HanlderOptions added in v1.1.0

type HanlderOptions func(h *Handler)

func PathSize added in v1.1.0

func PathSize(size int) HanlderOptions

type ResponseWriter

type ResponseWriter struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

func NewResponseWriter

func NewResponseWriter(w http.ResponseWriter) *ResponseWriter

func (*ResponseWriter) WriteHeader

func (w *ResponseWriter) WriteHeader(statusCode int)

Directories

Path Synopsis
example module

Jump to

Keyboard shortcuts

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