mirror of
				https://github.com/teamhanko/hanko.git
				synced 2025-10-31 08:35:47 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			16 lines
		
	
	
		
			611 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			16 lines
		
	
	
		
			611 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package middleware
 | |
| 
 | |
| import (
 | |
| 	"github.com/labstack/echo/v4"
 | |
| 	"github.com/labstack/echo/v4/middleware"
 | |
| )
 | |
| 
 | |
| func GetLoggerMiddleware() echo.MiddlewareFunc {
 | |
| 	return middleware.LoggerWithConfig(middleware.LoggerConfig{
 | |
| 		Format: `{"time":"${time_rfc3339_nano}","time_unix":"${time_unix}","id":"${id}","remote_ip":"${remote_ip}",` +
 | |
| 			`"host":"${host}","method":"${method}","uri":"${uri}","user_agent":"${user_agent}",` +
 | |
| 			`"status":${status},"error":"${error}","latency":${latency},"latency_human":"${latency_human}"` +
 | |
| 			`,"bytes_in":${bytes_in},"bytes_out":${bytes_out},"referer":"${referer}"}` + "\n",
 | |
| 	})
 | |
| }
 | 
