<commit_before>package httpLogger

import (
	"log"
	"net/http"
	"os"
	"strconv"
)

// Log the http request info and returnStatus/Time to fileHandler
func LogLine(request *http.Request, returnStatus int, returnString string, fileHandler *os.File, startTime int64, endTime int64) int {
	go logLineAsync(request, returnStatus, returnString, fileHandler, startTime, endTime)
	return 0
}

func logLineAsync(request *http.Request, returnStatus int, returnString string, fileHandler *os.File, startTime int64, endTime int64) {
	timeDiff := (float64(endTime) - float64(startTime)) / 1000000.0
	timeTakenString := strconv.FormatFloat(timeDiff, 'f', 3, 64)
	log.SetOutput(fileHandler)
	httpReturnStatus := strconv.FormatInt(int64(returnStatus), 10)
	responseLength := strconv.FormatInt(int64(len(returnString)), 10)
	if request.URL.RawQuery != "" {
		log.Println(request.Host + " " + request.RemoteAddr + " \"" + request.Method + " " + request.URL.Path + "?" + request.URL.RawQuery + " " + request.Proto + "\"" + " " + httpReturnStatus + " " + responseLength + " " + "\"" + request.Header.Get("User-Agent") + "\"" + " " + timeTakenString)
	} else {
		log.Println(request.Host + " " + request.RemoteAddr + " \"" + request.Method + " " + request.URL.Path + " " + request.Proto + "\"" + " " + httpReturnStatus + " " + responseLength + " " + "\"" + request.Header.Get("User-Agent") + "\"" + " " + timeTakenString)
	}<commit_msg>add comment to function<commit_after>package httpLogger

import (
	"log"
	"net/http"
	"os"
	"strconv"
)

// LogLine functions logs  the http request info and returnStatus/Time to fileHandler
func LogLine(request *http.Request, returnStatus int, returnString string, fileHandler *os.File, startTime int64, endTime int64) int {
	go logLineAsync(request, returnStatus, returnString, fileHandler, startTime, endTime)
	return 0
}

func logLineAsync(request *http.Request, returnStatus int, returnString string, fileHandler *os.File, startTime int64, endTime int64) {
	timeDiff := (float64(endTime) - float64(startTime)) / 1000000.0
	timeTakenString := strconv.FormatFloat(timeDiff, 'f', 3, 64)
	log.SetOutput(fileHandler)
	httpReturnStatus := strconv.FormatInt(int64(returnStatus), 10)
	responseLength := strconv.FormatInt(int64(len(returnString)), 10)
	if request.URL.RawQuery != "" {
		log.Println(request.Host + " " + request.RemoteAddr + " \"" + request.Method + " " + request.URL.Path + "?" + request.URL.RawQuery + " " + request.Proto + "\"" + " " + httpReturnStatus + " " + responseLength + " " + "\"" + request.Header.Get("User-Agent") + "\"" + " " + timeTakenString)
	} else {
		log.Println(request.Host + " " + request.RemoteAddr + " \"" + request.Method + " " + request.URL.Path + " " + request.Proto + "\"" + " " + httpReturnStatus + " " + responseLength + " " + "\"" + request.Header.Get("User-Agent") + "\"" + " " + timeTakenString)
	}
{'fraction_non_alphanumeric': 0.16655003498950316, 'fraction_numerical': 0.02239328201539538, 'mean_word_length': 4.551456310679612, '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': '7168469', 'n_tokens_mistral': 986, 'n_tokens_neox': 934, 'n_words': 185}