<commit_before>package task2

import (
	"fmt"
	"io"
	"log"
	"log/syslog"
	"net/url"
	"os"
	"path/filepath"

	"sync"
)

var LogDir = filepath.Join(os.TempDir(), "sg-log")

func init() {
	err := os.MkdirAll(LogDir, 0700)
	if err != nil {
		log.Fatal(err)
	}
}

type Logger struct {
	*log.Logger
	io.Writer
	Destination string
	c           []io.Closer
}

func (x *Logger) Close() error {
	if len(x.c) == 0 {
		return nil
	}
	for _, c := range x.c {
		err := c.Close()
		if err != nil {
			return err
		}
	}
	return nil
}

func LogURLForTag(tag string) string {
	return fmt.Sprintf("https://papertrailapp.com/groups/591393/events?q=program:%s", url.QueryEscape(tag))
}

func NewPapertrailLogger(tag string) *syslog.Writer {
	pw, err := syslog.Dial("udp", "logs.papertrailapp.com:50140", syslog.LOG_INFO, tag)
	if err != nil {
		log.Fatal(err)
	}
	return pw
}
<commit_msg>keep open fewer files during make<commit_after>package task2

import (
	"fmt"
	"io"
	"log"
	"log/syslog"
	"net/url"
	"os"
	"path/filepath"

	"sync"
)

var LogDir = filepath.Join(os.TempDir(), "sg-log")

func init() {
	err := os.MkdirAll(LogDir, 0700)
	if err != nil {
		log.Fatal(err)
	}
}

type Logger struct {
	*log.Logger
	io.Writer
	Destination string
	c           []io.Closer
}

func (x *Logger) Close() error {
	if len(x.c) == 0 {
		return nil
	}
	for _, c := range x.c {
		err := c.Close()
		if err != nil {
			return err
		}
	}
	x.c = nil
	return nil
}

func LogURLForTag(tag string) string {
	return fmt.Sprintf("https://papertrailapp.com/groups/591393/events?q=program:%s", url.QueryEscape(tag))
}

func NewPapertrailLogger(tag string) *syslog.Writer {
	pw, err := syslog.Dial("udp", "logs.papertrailapp.com:50140", syslog.LOG_INFO, tag)
	if err != nil {
		log.Fatal(err)
	}
	return pw
}

{'fraction_non_alphanumeric': 0.1631728045325779, 'fraction_numerical': 0.019263456090651557, 'mean_word_length': 3.360493827160494, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '1252432', 'n_tokens_mistral': 793, 'n_tokens_neox': 750, 'n_words': 165}