<commit_before>package log

import(
	"fmt"
	"time"
)

type Logger struct {
	Level LogLevel
}

type LogLevel int
const (
	TRACE = iota
	DEBUG
	WARN
	INFO
	ERROR
	FATAL
)
var levels = map[LogLevel]string{
	TRACE: "TRACE",
	DEBUG: "DEBUG",
	WARN: "WARN",
	INFO: "INFO",
	ERROR: "ERROR",
	FATAL: "FATAL",
}

var logger *Logger

func New(level LogLevel) *Logger {
	return &Logger{
		Level: level,
	}
}

func Write(level LogLevel, message string, params ...interface{}) {
	p := append([]interface{}{time.Now(), levels[level]}, params...)
	fmt.Printf("[%s] [%s] " + message + "\n", p...)
}

func Unwrap(args ...interface{}) []interface{} {
	head := args[0]
	switch head.(type) {
	case func(...interface{})[]interface{}:
		args = head.(func(...interface{})[]interface{})(args[1:]...)
	}
	return args
}

func Log(level LogLevel, params ...interface{}) {
	if logger == nil { logger = New(DEBUG) }
	logger.Log(level, params...)
}
func Debug(params ...interface{}) {	Log(DEBUG, Unwrap(params...)...) }
func Info(params ...interface{}) { Log(INFO, Unwrap(params...)...) }
func Warn(params ...interface{}) { Log(WARN, Unwrap(params...)...) }
func Error(params ...interface{}) {	Log(ERROR, Unwrap(params...)...) }
func Trace(params ...interface{}) {	Log(TRACE, Unwrap(params...)...) }
func Printf(params ...interface{}) { Log(INFO, Unwrap(params...)...) }
func Println(params ...interface{}) { Log(INFO, Unwrap(params...)...) }
func Fatalf(params ...interface{}) { Log(FATAL, Unwrap(params...)...) }

func (l *Logger) Write(level LogLevel, message string, params ...interface{}) { 
	Write(level, message, params...) 
}
func (l *Logger) Log(level LogLevel, params ...interface{}) { 
	l.Write(level, params[0].(string), params[1:]...) 
}<commit_msg>Support nested unwrapping<commit_after>package log

import(
	"fmt"
	"time"
)

type Logger struct {
	Level LogLevel
}

type LogLevel int
const (
	TRACE = iota
	DEBUG
	WARN
	INFO
	ERROR
	FATAL
)
var levels = map[LogLevel]string{
	TRACE: "TRACE",
	DEBUG: "DEBUG",
	WARN: "WARN",
	INFO: "INFO",
	ERROR: "ERROR",
	FATAL: "FATAL",
}

var logger *Logger

func New(level LogLevel) *Logger {
	return &Logger{
		Level: level,
	}
}

func Write(level LogLevel, message string, params ...interface{}) {
	p := append([]interface{}{time.Now(), levels[level]}, params...)
	fmt.Printf("[%s] [%s] " + message + "\n", p...)
}

func Unwrap(args ...interface{}) []interface{} {
	head := args[0]
	switch head.(type) {
	case func(...interface{})[]interface{}:
		args = Unwrap(head.(func(...interface{})[]interface{})(args[1:]...)...)
	}
	return args
}

func Log(level LogLevel, params ...interface{}) {
	if logger == nil { logger = New(DEBUG) }
	logger.Log(level, params...)
}
func Debug(params ...interface{}) {	Log(DEBUG, Unwrap(params...)...) }
func Info(params ...interface{}) { Log(INFO, Unwrap(params...)...) }
func Warn(params ...interface{}) { Log(WARN, Unwrap(params...)...) }
func Error(params ...interface{}) {	Log(ERROR, Unwrap(params...)...) }
func Trace(params ...interface{}) {	Log(TRACE, Unwrap(params...)...) }
func Printf(params ...interface{}) { Log(INFO, Unwrap(params...)...) }
func Println(params ...interface{}) { Log(INFO, Unwrap(params...)...) }
func Fatalf(params ...interface{}) { Log(FATAL, Unwrap(params...)...) }

func (l *Logger) Write(level LogLevel, message string, params ...interface{}) { 
	Write(level, message, params...) 
}
func (l *Logger) Log(level LogLevel, params ...interface{}) { 
	l.Write(level, params[0].(string), params[1:]...) 
}
{'fraction_non_alphanumeric': 0.22856323487238314, 'fraction_numerical': 0.002294235732721537, 'mean_word_length': 3.7650273224043715, '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': '5230215', 'n_tokens_mistral': 1187, 'n_tokens_neox': 1194, 'n_words': 304}