<commit_before>package loafer

import (
	"fmt"
)

type Formatter interface {
	Format(Fields) ([]byte, error)
}

type defaultFormatter struct{}

// TODO fix the colour rendering
var colorArr []string = []string{"\x1b[32;1m ", "\x1b[33;1m ", "\x1b[35;1m ", "\x1b[31;1m "}

func (d *defaultFormatter) Format(f Fields) ([]byte, error) {
	var str string
	if val, ok := f["level"]; ok {
		str += colorArr[val.(level)]
	}
	for key, value := range f {
		str += fmt.Sprintf("[ %s ] %+v ", key, value)<commit_msg>better formating in default<commit_after>package loafer

import (
	"fmt"
)

type Formatter interface {
	Format(Fields) ([]byte, error)
}

type defaultFormatter struct{}

// TODO fix the colour rendering
var colorArr []string = []string{"\x1b[32;1m ", "\x1b[33;1m ", "\x1b[35;1m ", "\x1b[31;1m "}

func (d *defaultFormatter) Format(f Fields) ([]byte, error) {
	var str string
	if val, ok := f["level"]; ok {
		str += colorArr[val.(level)]
	}

	if tUid, ok := f["uid"]; ok {
		str += fmt.Sprintf("[ %s ] %+v ", "uid", tUid)
		delete(f, "uid")
	}

	if tLvl, ok := f["level"]; ok {
		str += fmt.Sprintf("[ %s ] %+v ", "level", tLvl)
		delete(f, "level")
	}

	if tVal, ok := f["time"]; ok {
		str += fmt.Sprintf("[ %s ] %+v ", "time", tVal)
		delete(f, "time")
	}

	for key, value := range f {
		str += fmt.Sprintf("[ %s ] %+v ", key, value)
{'fraction_non_alphanumeric': 0.2128454070201643, 'fraction_numerical': 0.02389843166542196, 'mean_word_length': 3.8550724637681157, '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': '5469276', 'n_tokens_mistral': 559, 'n_tokens_neox': 537, 'n_words': 147}