• Stars
    star
    107
  • Rank 321,463 (Top 7 %)
  • Language
    Go
  • License
    MIT License
  • Created almost 10 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Go library to log http.Client's requests and responses automatically

go-loghttp

Log http.Client's requests and responses automatically.

GoDoc

Synopsis

To log all the HTTP requests/responses, import github.com/motemen/go-loghttp/global.

package main

import (
	"io"
	"log"
	"net/http"
	"os"

	_ "github.com/motemen/go-loghttp/global" // Just this line!
)

func main() {
	resp, err := http.Get(os.Args[1])
	if err != nil {
		log.Fatal(err)
	}

	io.Copy(os.Stdout, resp.Body)
}
% go run main.go http://example.com/
2014/12/02 13:36:27 ---> GET http://example.com/
2014/12/02 13:36:27 <--- 200 http://example.com/
<!doctype html>
...

Or set loghttp.Transport to http.Client's Transport field.

import "github.com/motemen/go-loghttp"

client := &http.Client{
	Transport: &loghttp.Transport{},
}

You can modify loghttp.Transport's LogRequest and LogResponse to customize logging function.

Author

motemen [email protected]

More Repositories

1

git-vim

My vim files for Git
Vim Script
576
star
2

gompatible

A tool to show Go package's API changes between two (git) revisions
Go
173
star
3

minimatch-cheat-sheet

A cheat sheet for minimatch
JavaScript
98
star
4

lgtm.sh

The fastest way to generate animated LGTM images
Shell
68
star
5

git-browse-remote

Open web browser to view remote Git repositories
Ruby
59
star
6

gas-cronsheet-slack

Google Apps Script to use spreadsheet for timed posts to Slack
JavaScript
53
star
7

go-pocket

Pocket (getpocket.com) API client for Go (golang).
Go
50
star
8

gofind

gofind searches through Go source code by types.
Go
48
star
9

Wight

Communicate with PhantomJS in Perl (Capybara+Poltergeist to Perl)
Perl
48
star
10

go-for-go-book

WIP
Ruby
48
star
11

github-list-starred

List GitHub repositories starred by a user
Go
48
star
12

polka

Web DJ
JavaScript
42
star
13

Teto

nicovideo stream player
Perl
40
star
14

prchecklist

Provides checklists based on release PR
Go
37
star
15

yaruo

やる夫で学ぶシリーズ
Ruby
37
star
16

go-sqlf

Simple and obvious Printf-like SQL generator
Go
37
star
17

gas-slack-log-spreadsheet

TypeScript
36
star
18

go-typeswitch-gen

Expands type switches with type variables to achieve generic functions in Golang
Go
34
star
19

go-iferr

Smartly inserts idiomatic "err" handling code in Go
Go
34
star
20

gcal-tui

Go
31
star
21

go-quickfix

Quick fix non-compiling well-typed Go source code e.g. "x declared and not used."
Go
31
star
22

go-cli

Yet another CLI app builder with commands, based on documentation.
Go
30
star
23

dts-google-apps-script

d.ts files for Google Apps Script
JavaScript
29
star
24

slack-stream-json

Rust
28
star
25

hatena-vim

Vim scripts for posting/updating hatena diary/group
Vim Script
27
star
26

go-testutil

Go
27
star
27

App-htmlcat

redirect stdin to web browser
Perl
27
star
28

Plack-Middleware-WebSocket

WebSocket handshake helper middleware
Perl
26
star
29

xslate-vim

Vim Script
25
star
30

arrow-js

Equip JavaScript with arrows
JavaScript
20
star
31

android-PicTumblr

Android app for Tumblr picture reblogging
Scala
19
star
32

github-userscripts

GitHub userscripts
JavaScript
19
star
33

furoshiki2

Python
18
star
34

go-nuts

Go code I want sometimes but too small to be a separate library
Go
17
star
35

TextCast

TypeScript
17
star
36

go-graphql-query

Go
16
star
37

git-log-relay-chat

chat on git commit log
Perl
15
star
38

example-scrape-websites

Examples scripts to scrape websites
JavaScript
15
star
39

modoi

nijiura proxy
Perl
14
star
40

chrome-Flavoured-Favicon

Change color tastes of favicons by their domains
TypeScript
14
star
41

gas-google-calendar-to-slack-status-farm

JavaScript
14
star
42

homebrew-ghq

DEPREACATED: please use homebrew-core
Ruby
14
star
43

Kindlenap

Generate HTML files suitable for kindlegen.
Perl
13
star
44

git-unify

Share .git directory among local repositories of same origin
Shell
13
star
45

go-colorine

A simple colorized console logger
Go
12
star
46

pusheen-explorer

Explore Pusheen Pics!
JavaScript
12
star
47

chrome-GitHub-Issue-Badges

Chrome extension to embed GitHub Issue Badge's into GitHub issues
TypeScript
11
star
48

go-ctxize

Rewrite functions to have "Context"s
Go
11
star
49

go-gitconfig

Go library for loading git config
Go
11
star
50

AnyEvent-DAAP-Server

DAAP server implemented on AnyEvent
Perl
11
star
51

as3-klt

Kanade-Lucas-Tomasi feature tracker implementation in as3
ActionScript
11
star
52

jusk

Haskell implemented JavaScript interpreter
Haskell
10
star
53

Travel-Handbook

旅の栞
10
star
54

gobin.cc

Go
9
star
55

vim-help-random

a Vim plugin to open a help topic randomly
Vim Script
9
star
56

sketch-eth-pay-for-content

JavaScript
9
star
57

image-opencv

Perl interface for opencv library
C
9
star
58

mir

Go
8
star
59

chrome-extension-esbuild

TypeScript
8
star
60

hub-pr

Personal workflow handling GitHub Pull Requests
Go
8
star
61

adsense-report-menubar

AdSense performance report on the menubar
TypeScript
8
star
62

hatena-welcome-speech

8
star
63

sbx

An unofficial Scrapbox client
Go
8
star
64

futimer

Web-based speedcubing timer
TypeScript
7
star
65

Class-Accessor-Lite-Lazy

Class::Accessor::Lite with lazy accessor feature
Perl
7
star
66

docker-julius

Dockerfile for Julius and its dictation kit.
Shell
7
star
67

gas-TaskCal

TypeScript
7
star
68

docker-mod_perl

Dockerfile
7
star
69

forward2docker

Easily build and start a docker container and set up port forwardings to it, using boot2docker
Shell
7
star
70

adsense-report-cli

Generate Google Adsense's report in your terminal
Go
7
star
71

chrome-meet-mute-toggler

Easily toggle your microphone mutes on Google Meet meetings, by clicking toolbar button.
TypeScript
7
star
72

macos-BluetoothAudioDistancer

Swift
6
star
73

perl5-Print-Indented

Outputs indented as per source code indentation
Perl
6
star
74

node-humr

Makes input lines into human-readable ones
TypeScript
6
star
75

tap-vim

TAP (Test Anything Protocol) parser
Vim Script
6
star
76

wercker-box-golang-goxc

Wercker box for cross-compiling Go using goxc
6
star
77

App-sn

Command-line Simplenote client
Perl
6
star
78

github-commit-status-mark

View GitHub's commit status on your terminal, ✗●✓
Go
5
star
79

webextension-obfuscate-texts

TypeScript
5
star
80

qiita-dl

Go
5
star
81

kao-vault

my kaomoji collection
5
star
82

example-go-bubbletea

Go
5
star
83

HTTP-Response-Maker

easy HTTP response object maker functions
Perl
5
star
84

pocket-expose-web

Creates public feeds of Pocket list
Go
5
star
85

dotfiles

My dotfiles
Vim Script
5
star
86

Warg

Downloader
Perl
5
star
87

git-hub-sync-repo-info

Synchronize .git/description and .git/homepage files with GitHub repository's info
Ruby
5
star
88

vim-guess-abbrev

expand input dynamically http://subtech.g.hatena.ne.jp/motemen/20101215/1292414533
Vim Script
5
star
89

long-weekends-ng

JavaScript
5
star
90

perl5-Test-Retry

Retry a code block for several times until a test function succeeds
Perl
5
star
91

stablediffusion-server-on-colab

Jupyter Notebook
5
star
92

go-switchgen

Go
5
star
93

lambda-calculator

Scala
4
star
94

goreadme

Easy templating Go package READMEs
Go
4
star
95

webusurai

TypeScript
4
star
96

android-AnimeFaceDemo

Imager::AnimeFace android port test
C
4
star
97

web-year-progress

TypeScript
4
star
98

perl5-Test-Deep-JSON

Provide json() function for Test::Deep comparison
Perl
4
star
99

beautiful-graph-maker

JavaScript
4
star
100

WebService-8tracks

Handle 8tracks API
Perl
4
star