<commit_before>package main

import (
    "flag"
    "fmt"
    "log"
    "net/http"
    "strings"
)

func handler(w http.ResponseWriter, r *http.Request) {
    msg := "Request " + r.URL.Path
    for k, v := range r.Header {
        msg += ";\n\t" + k + ": " + strings.Join(v, ",")
    }

    // Copy the request body
    body_part := make([]byte, 20)
    var body string
    n, err := r.Body.Read(body_part)
    if err != nil {
        body = "<Empty>"
    } else {
        body = string(body_part[:n])
    }

    msg += "\nBody: '" + body + "'"

    fmt.Fprintf(w, msg)
}

func main() {
    var port = flag.String("port", ":8090", "Port to listen on")
    flag.Parse()

    log.Println("Listening on", *port)
<commit_msg>Improve logging and reponse in endpoint.<commit_after>package main

import (
    "flag"
    "fmt"
    "log"
    "net/http"
    "strings"
)

func handler(w http.ResponseWriter, r *http.Request) {
    log.Println("Incoming request for", r.URL.Path)

    msg := "Request:" + r.URL.Path
    msg += "\nHeaders:"
    for k, v := range r.Header {
        msg += k + ": " + strings.Join(v, ",") + ";"
    }

    // Copy the request body
    body_part := make([]byte, 20)
    var body string
    n, err := r.Body.Read(body_part)
    if err != nil {
        body = "<Empty>"
    } else {
        body = string(body_part[:n])
    }

    msg += "\nBody:" + body

    fmt.Fprintf(w, msg)
}

func main() {
    var port = flag.String("port", ":8090", "Port to listen on")
    flag.Parse()

    log.Println("Listening on", *port)

{'fraction_non_alphanumeric': 0.177734375, 'fraction_numerical': 0.0078125, 'mean_word_length': 2.2222222222222223, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 5, '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': '3973925', 'n_tokens_mistral': 568, 'n_tokens_neox': 549, 'n_words': 140}