global

package
v0.0.0-...-29ae44b Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: MIT Imports: 2 Imported by: 27

Documentation

Overview

Package global automatically sets http.DefaultTransport to loghttp.DefaultTransport when loaded.

Example
package main

import (
	"net/http"

	_ "github.com/motemen/go-loghttp/global"
)

var client = &http.Client{}

func main() {
	// Automatically logs requests/responses
	//
	// For example:
	// 2014/12/01 19:33:10 ---> GET http://www.example.com/
	// 2014/12/01 19:33:11 <--- 200 http://www.example.com/
	client.Get("http://www.example.com/")
}
Output:

Jump to

Keyboard shortcuts

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