<commit_before>package standard

import (
	"encoding/json"
	"fmt"
	"log"
	"strings"

	"github.com/tomogoma/authms/logging"
)

func init() {
	logging.SetEntryLoggerFunc(Log)
}

func Log(e logging.Entry) {
	if e.Level == logging.LevelFatal {
		out(e)
		return
	}
	go out(e)
}

func out(e logging.Entry) {
	fields := "{"
	for k, v := range e.Fields {
		vStr, _ := json.Marshal(v)
		fields = fmt.Sprintf("%s\"%s\": \"%s\", ", fields, k, vStr)
	}
	fields = strings.TrimSuffix(fields, ", ") + "}"
	log.Printf("%s - %s: %s %s", e.Level, e.Time, e.Payload, fields)
}<commit_msg>log new line<commit_after>package standard

import (
	"encoding/json"
	"fmt"
	"log"
	"strings"

	"github.com/tomogoma/authms/logging"
)

func init() {
	logging.SetEntryLoggerFunc(Log)
}

func Log(e logging.Entry) {
	if e.Level == logging.LevelFatal {
		out(e)
		return
	}
	go out(e)
}

func out(e logging.Entry) {
	fields := "{"
	for k, v := range e.Fields {
		vStr, _ := json.Marshal(v)
		fields = fmt.Sprintf("%s\"%s\": \"%s\", ", fields, k, vStr)
	}
	fields = strings.TrimSuffix(fields, ", ") + "}"
	log.Printf("%s - %s: %s %s\n", e.Level, e.Time, e.Payload, fields)
}
{'fraction_non_alphanumeric': 0.2042068361086766, 'fraction_numerical': 0.0, 'mean_word_length': 3.568, 'pattern_counts': {'":': 2, '<': 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': '6856775', 'n_tokens_mistral': 491, 'n_tokens_neox': 477, 'n_words': 98}