<commit_before>package looli

import (
	"fmt"
	"io"
	"os"
	"time"
)

var defaultWriter = os.Stdout

func Logger() HandlerFunc {
	return LoggerWithWriter(defaultWriter)
}

func LoggerWithWriter(out io.Writer) HandlerFunc {
	return func(c *Context) {
		start := time.Now()
		path := c.Path
		method := c.Request.Method
		c.Next()

		end := time.Now()
		latency := end.Sub(start)
		clientIP := c.ClientIP()
		statusCode := c.statusCode

		fmt.Fprintf(out, "[looli] %v | %3d | %8v | %s | %-7s %s\n",
			end.Format("2006/01/01 - 15:04:05"),
			statusCode,
			latency,
			clientIP,
			method,
			path,
		)
	}
}<commit_msg>fix: optimize logger output formatt<commit_after>package looli

import (
	"fmt"
	"io"
	"os"
	"time"
)

var defaultWriter = os.Stdout

func Logger() HandlerFunc {
	return LoggerWithWriter(defaultWriter)
}

func LoggerWithWriter(out io.Writer) HandlerFunc {
	return func(c *Context) {
		start := time.Now()
		path := c.Path
		method := c.Request.Method
		c.Next()

		end := time.Now()
		latency := end.Sub(start)
		clientIP := c.ClientIP()
		statusCode := c.statusCode

		fmt.Fprintf(out, "[looli] %v | %3d | %11v | %s | %-7s %s\n",
			end.Format("2006/01/01 - 15:04:05"),
			statusCode,
			latency,
			clientIP,
			method,
			path,
		)
	}
}
{'fraction_non_alphanumeric': 0.16175298804780877, 'fraction_numerical': 0.027888446215139442, 'mean_word_length': 3.3460207612456747, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1481016', 'n_tokens_mistral': 571, 'n_tokens_neox': 499, 'n_words': 108}