<commit_before>// Callbacks handles receiving notifications from repository sources like
// GitHub.
package callbacks

import (
	"encoding/json"
	"io/ioutil"
	"net/http"
)

type Notification interface {
	Branch() string
	URL() string
	By() (string, string)
}

func Callback(rw http.ResponseWriter, req *http.Request, not chan Notification) {
	body, err := ioutil.ReadAll(req.Body)
	if err != nil {
		panic("reading")
	}

	var cb GitHubCallback
	err = json.Unmarshal(body, &cb)

	if err != nil {
		panic("could not unmarshal request")
	}

	not <- &cb
}<commit_msg>better logging for callback<commit_after>// Callbacks handles receiving notifications from repository sources like
// GitHub.
package callbacks

import (
	"encoding/json"
	"io/ioutil"
	"log"
	"net/http"
)

type Notification interface {
	Branch() string
	URL() string
	By() (string, string)
}

func Callback(rw http.ResponseWriter, req *http.Request, not chan Notification) {
	body, err := ioutil.ReadAll(req.Body)
	if err != nil {
		panic("reading")
	}

	var cb GitHubCallback
	err = json.Unmarshal(body, &cb)

	if err != nil {
		log.Println("Could not unmarshal request")
		log.Println(string(body))
	}

	not <- &cb
}
{'fraction_non_alphanumeric': 0.12701100762066045, 'fraction_numerical': 0.0, 'mean_word_length': 4.1615720524017465, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3704850', 'n_tokens_mistral': 425, 'n_tokens_neox': 393, 'n_words': 117}