<commit_before>package logged

import (
	"runtime"
	"strings"
	"time"
)

const (
	Info  = "info"
	Debug = "debug"
)

type Log interface {
	Info(message string, data map[string]string) error
	Debug(message string, data map[string]string) error
	IsDebug() bool
}

type Config struct {
	Serializer    Serializer
	DebugPackages []string
	Defaults      map[string]string
}

func New(c *Config) Log {
	return &log{
		serializer:    c.Serializer,
		debugPackages: c.DebugPackages,
		defaults:      c.Defaults,
	}
}

type log struct {
	serializer    Serializer
	defaults      map[string]string
	debugPackages []string
}

func (l *log) Info(message string, data map[string]string) error {
	return l.write(Info, message, data)
}

func (l *log) Debug(message string, data map[string]string) error {
	if l.IsDebug() {
		return l.write(Debug, message, data)
	}
	return nil
}

func (l *log) IsDebug() bool {
	if len(l.debugPackages) == 0 {
		return false
	}

	pc, _, _, _ := runtime.Caller(2)<commit_msg>Add wildcard debug package<commit_after>package logged

import (
	"runtime"
	"strings"
	"time"
)

const (
	Info  = "info"
	Debug = "debug"
)

type Log interface {
	Info(message string, data map[string]string) error
	Debug(message string, data map[string]string) error
	IsDebug() bool
}

type Config struct {
	Serializer    Serializer
	DebugPackages []string
	Defaults      map[string]string
}

func New(c *Config) Log {
	return &log{
		serializer:    c.Serializer,
		debugPackages: c.DebugPackages,
		defaults:      c.Defaults,
	}
}

type log struct {
	serializer    Serializer
	defaults      map[string]string
	debugPackages []string
}

func (l *log) Info(message string, data map[string]string) error {
	return l.write(Info, message, data)
}

func (l *log) Debug(message string, data map[string]string) error {
	if l.IsDebug() {
		return l.write(Debug, message, data)
	}
	return nil
}

func (l *log) IsDebug() bool {
	if len(l.debugPackages) == 0 {
		return false
	}

	if l.debugPackages[0] == "*" {
		return true
	}

	pc, _, _, _ := runtime.Caller(2)
{'fraction_non_alphanumeric': 0.12041116005873716, 'fraction_numerical': 0.0024473813020068525, 'mean_word_length': 3.889952153110048, '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': '2685686', 'n_tokens_mistral': 745, 'n_tokens_neox': 719, 'n_words': 198}