Skip to content

# This package log and modify data for http.ResponseWriter

Notifications You must be signed in to change notification settings

s4l1h/responselogger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This package log and modify data for http.ResponseWriter

Bu paketi http.ResponseWriter'a yazılan dataları debug edebilmek ve değiştirmek için kullanabilirsiniz.

Install

go get github.com/s4l1h/responselogger

Usage Echo FrameWork

e := echo.New()

e.Use(responselogger.EchoMiddleware(func(b []byte) []byte{
	log.Print(string(b))
	return b
}))
http.HandleFunc("/path", responselogger.Middleware(handler,func(b []byte) []byte{
	log.Print(string(b))
	return b
}))

Complex Example Log and modify data

func changeAllAdultWords(b []byte) []byte {
	data := string(b)
	log.Print(data)                                 // print log
	data = strings.Replace(data, "porn", "***", -1) // modify data (replace "porn" to "***")
	return []byte(data)                             // return new data for writer
}
e := echo.New()
e.Use(responselogger.EchoMiddleware(changeAllAdultWords))

About

# This package log and modify data for http.ResponseWriter

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages