<commit_before>package extdirect
import (
	stdlog "log"
	"os"
	"github.com/Sirupsen/logrus"
	"strings"
	"runtime/debug"
)

type logger interface {
	Print(v ...interface{})
}

const (
	logLevelInfo = "info: "
	logLevelWarn = "warn: "
)

var log logger = stdlog.New(os.Stderr, "", stdlog.LstdFlags)

func SetLogger(l logger) {
	log = l
}

type LogrusLogger struct {
	L *logrus.Entry
}
func (this *LogrusLogger) Print(v ...interface{}) {
	if len(v) == 0 {
		return
	}
	l := this.L
	if len(v) == 1 {
		if err, errOk := v[0].(error); errOk {
			if err2, err2Ok := err.(*ErrDirectActionMethod); err2Ok {
				l = l.WithFields(logrus.Fields{
					"action": err2.Action,
					"method": err2.Method,
					"stack": string(debug.Stack()),
				})
			}
			l.Error(err)
		} else {
			l.Debug(v[0])
		}
	} else {
		if len(v) > 2 {
			l = l.WithFields(v[2].(map[string]interface{}))
		}

		m := strings.TrimSpace(v[1].(string))
		switch strings.TrimSpace(v[0].(string)) {
		case logLevelInfo: l.Info(m)
		case logLevelWarn: l.Warn(m)
		}
	}
}<commit_msg>Log level definition fixed.<commit_after>package extdirect
import (
	stdlog "log"
	"os"
	"github.com/Sirupsen/logrus"
	"strings"
	"runtime/debug"
)

type logger interface {
	Print(v ...interface{})
}

const (
	logLevelInfo = "info: "
	logLevelWarn = "warn: "
)

var log logger = stdlog.New(os.Stderr, "", stdlog.LstdFlags)

func SetLogger(l logger) {
	log = l
}

type LogrusLogger struct {
	L *logrus.Entry
}
func (this *LogrusLogger) Print(v ...interface{}) {
	if len(v) == 0 {
		return
	}
	l := this.L
	if len(v) == 1 {
		if err, errOk := v[0].(error); errOk {
			if err2, err2Ok := err.(*ErrDirectActionMethod); err2Ok {
				l = l.WithFields(logrus.Fields{
					"action": err2.Action,
					"method": err2.Method,
					"stack": string(debug.Stack()),
				})
			}
			l.Error(err)
		} else {
			l.Debug(v[0])
		}
	} else {
		if len(v) > 2 {
			l = l.WithFields(v[2].(map[string]interface{}))
		}

		m := strings.TrimSpace(v[1].(string))
		logLevel := v[0].(string)
		switch logLevel {
		case logLevelInfo: l.Info(m)
		case logLevelWarn: l.Warn(m)
		default: stdlog.Panicf("Unknow log message type: '%v'", logLevel)
		}
	}
}
{'fraction_non_alphanumeric': 0.18009259259259258, 'fraction_numerical': 0.012037037037037037, 'mean_word_length': 3.279207920792079, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 5, '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': '5838300', 'n_tokens_mistral': 972, 'n_tokens_neox': 886, 'n_words': 182}