<commit_before>package logging

import (
	"fmt"
	"os"
	"sync"

	gologging "github.com/op/go-logging"
)

var (
	syncRoot       *sync.RWMutex
	backendLeveled gologging.LeveledBackend
)

type Logger struct {
	log *gologging.Logger
}

func init() {
	syncRoot = &sync.RWMutex{}
	format := gologging.MustStringFormatter("%{color}%{time:15:04:05:000} %{shortfunc} > %{level:.4s} %{id:03x}%{color:reset} %{message}")
	backend := gologging.NewLogBackend(os.Stdout, "", 0)
	backendFormatter := gologging.NewBackendFormatter(backend, format)
	backendLeveled = gologging.AddModuleLevel(backendFormatter)
	backendLeveled.SetLevel(gologging.INFO, "")
	gologging.SetBackend(backendLeveled)
}

func SetLevel(level LogLevel) {
	syncRoot.Lock()
	defer syncRoot.Unlock()
	backendLeveled.SetLevel(convertLogLevel(level), "")
}

func Log(name string) Logger {
	return Logger{
		log: gologging.MustGetLogger(name),
	}
}

func (l Logger) Error(msg string, err error) {
	l.log.Error(fmt.Sprintf("%s: %v", msg, err))
}

func (l Logger) Errorf(msg string, values ...interface{}) {
	l.log.Error(msg, values...)
}

func (l Logger) Info(msg string, values ...interface{}) {
	l.log.Info(msg, values...)
}<commit_msg>Adjusts the ExtraCalldepth for logging.<commit_after>package logging

import (
	"fmt"
	"os"
	"sync"

	gologging "github.com/op/go-logging"
)

var (
	syncRoot       *sync.RWMutex
	backendLeveled gologging.LeveledBackend
)

type Logger struct {
	log *gologging.Logger
}

func init() {
	syncRoot = &sync.RWMutex{}
	format := gologging.MustStringFormatter("%{color}%{time:15:04:05:000} %{shortfunc} > %{level:.4s} %{id:03x}%{color:reset} %{message}")
	backend := gologging.NewLogBackend(os.Stdout, "", 0)
	backendFormatter := gologging.NewBackendFormatter(backend, format)
	backendLeveled = gologging.AddModuleLevel(backendFormatter)
	backendLeveled.SetLevel(gologging.INFO, "")
	gologging.SetBackend(backendLeveled)
}

func SetLevel(level LogLevel) {
	syncRoot.Lock()
	defer syncRoot.Unlock()
	backendLeveled.SetLevel(convertLogLevel(level), "")
}

func Log(name string) Logger {
	l := gologging.MustGetLogger(name)
	l.ExtraCalldepth = 1
	return Logger{
		log: l,
	}
}

func (l Logger) Error(msg string, err error) {
	l.log.Error(fmt.Sprintf("%s: %v", msg, err))
}

func (l Logger) Errorf(msg string, values ...interface{}) {
	l.log.Error(msg, values...)
}

func (l Logger) Info(msg string, values ...interface{}) {
	l.log.Info(msg, values...)
}
{'fraction_non_alphanumeric': 0.16021416803953872, 'fraction_numerical': 0.011120263591433279, 'mean_word_length': 5.180661577608142, 'pattern_counts': {'":': 0, '<': 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': '1310989', 'n_tokens_mistral': 910, 'n_tokens_neox': 893, 'n_words': 172}