<commit_before>package api

import (
	"fmt"
	"net/http"

	"github.com/af83/edwig/audit"
	"github.com/af83/edwig/siri"
)

type SiriError struct {
	response       http.ResponseWriter
	errCode        string
	errDescription string
	request        string
}

func siriError(errCode, errDescription string, response http.ResponseWriter) {
	siriErrorWithRequest(errCode, errDescription, "", response)
}

func siriErrorWithRequest(errCode, errDescription, request string, response http.ResponseWriter) {
	SiriError{
		response:       response,
		errCode:        errCode,
		errDescription: errDescription,
		request:        request,
	}.sendSiriError()
}

func (siriError SiriError) sendSiriError() {<commit_msg>Add debug log when a SIRI error is sent<commit_after>package api

import (
	"fmt"
	"net/http"

	"github.com/af83/edwig/audit"
	"github.com/af83/edwig/logger"
	"github.com/af83/edwig/siri"
)

type SiriError struct {
	response       http.ResponseWriter
	errCode        string
	errDescription string
	request        string
}

func siriError(errCode, errDescription string, response http.ResponseWriter) {
	siriErrorWithRequest(errCode, errDescription, "", response)
}

func siriErrorWithRequest(errCode, errDescription, request string, response http.ResponseWriter) {
	SiriError{
		response:       response,
		errCode:        errCode,
		errDescription: errDescription,
		request:        request,
	}.sendSiriError()
}

func (siriError SiriError) sendSiriError() {
	logger.Log.Debugf("Send SIRI error %v : %v", siriError.errCode, siriError.errDescription)

{'fraction_non_alphanumeric': 0.09600515463917526, 'fraction_numerical': 0.006443298969072165, 'mean_word_length': 4.193979933110368, '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': '2176547', 'n_tokens_mistral': 522, 'n_tokens_neox': 506, 'n_words': 112}