<commit_before>package log

import (
	"log"
	"runtime"
	"strings"
)

// Stack logs the package pack with an error err and the stack trace.
func Stack(err error) {
	stack := make([]byte, 64<<10)
	stack = stack[:runtime.Stack(stack, false)]

	if pack, ok := callerPackage(); ok {
		log.Printf("%s: %v\n%s", pack, err, stack)
	} else {
		log.Printf("%v\n%s", err, stack)
	}
}

func callerPackage() (pack string, ok bool) {
	var pc uintptr
	if pc, _, _, ok = runtime.Caller(2); !ok {
		return
	}
	path := strings.Split(runtime.FuncForPC(pc).Name(), "/")
	pack = strings.Split(path[len(path)-1], ".")[0]
	return
}<commit_msg>Fix doc<commit_after>package log

import (
	"log"
	"runtime"
	"strings"
)

// Stack logs the error err with caller package and stack trace.
func Stack(err error) {
	stack := make([]byte, 64<<10)
	stack = stack[:runtime.Stack(stack, false)]

	if pack, ok := callerPackage(); ok {
		log.Printf("%s: %v\n%s", pack, err, stack)
	} else {
		log.Printf("%v\n%s", err, stack)
	}
}

func callerPackage() (pack string, ok bool) {
	var pc uintptr
	if pc, _, _, ok = runtime.Caller(2); !ok {
		return
	}
	path := strings.Split(runtime.FuncForPC(pc).Name(), "/")
	pack = strings.Split(path[len(path)-1], ".")[0]
	return
}
{'fraction_non_alphanumeric': 0.1887713588283157, 'fraction_numerical': 0.011391375101708706, 'mean_word_length': 3.9596774193548385, 'pattern_counts': {'":': 0, '<': 7, '<?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': '3037550', 'n_tokens_mistral': 478, 'n_tokens_neox': 462, 'n_words': 125}