<commit_before>package logs

import (
	"encoding/json"
	"reflect"
	"strings"
	"time"
)

type LogLevel int

const (
	Info LogLevel = iota
	Warn
	Debug
	Error
	Other
)

func (l LogLevel) String() string {
	switch l {
	case Info:
		return "Info"
	case Warn:
		return "Warn"
	case Debug:
		return "Debug"
	case Error:
		return "Error"
	}

	return "Other"
}

func levelFromString(level string) (LogLevel, error) {
	switch level {
	case "Info":
		return Info, nil
	case "Warn":
		return Warn, nil
	case "Error":
		return Error, nil
	case "Debug":
		return Debug, nil
	}

	return Other, nil
}

// UnmarshalJSON parses a log level given as string in json
func (l *LogLevel) UnmarshalJSON(data []byte) error {

	dataString := string(data)
	dataString = strings.Trim(dataString, "\"")

	level, err := levelFromString(dataString)

	if err != nil {
		return &json.UnsupportedValueError{Value: reflect.ValueOf(data), Str: dataString}
	}

	*l = level
	return nil
}

type LogEvent struct {
	Message string
	Level   LogLevel
	Time    time.Time
}

type LogEvents struct {
	Events []LogEvent
}<commit_msg>Simplification, added verbose level<commit_after>package logs

import (
	"strings"
	"time"
)

type LogLevel int

const (
	Verbose LogLevel = iota
	Info
	Warn
	Debug
	Error
	Other
)

func (l LogLevel) String() string {
	switch l {
	case Verbose:
		return "Verbose"
	case Info:
		return "Info"
	case Warn:
		return "Warn"
	case Debug:
		return "Debug"
	case Error:
		return "Error"
	}

	return "Other"
}

func levelFromString(level string) LogLevel {
	switch level {
	case "Verbose":
		return Verbose
	case "Info":
		return Info
	case "Warn":
		return Warn
	case "Error":
		return Error
	case "Debug":
		return Debug
	}

	return Other
}

// UnmarshalJSON parses a log level given as string in json
func (l *LogLevel) UnmarshalJSON(data []byte) error {

	dataString := string(data)
	dataString = strings.Trim(dataString, "\"")

	level := levelFromString(dataString)

	*l = level
	return nil
}

type LogEvent struct {
	Message string
	Level   LogLevel
	Time    time.Time
}

type LogEvents struct {
	Events []LogEvent
}
{'fraction_non_alphanumeric': 0.10138029509757258, 'fraction_numerical': 0.0, 'mean_word_length': 3.713004484304933, 'pattern_counts': {'":': 9, '<': 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': '1114916', 'n_tokens_mistral': 783, 'n_tokens_neox': 747, 'n_words': 239}