<commit_before>package log

import (
    "bufio"
    "os"
)

type appender2File struct {
    path string
    max  int64

    fd          *os.File
    writer      *bufio.Writer
    check_count int
}

func (self *appender2File) init() error {
    return self.checkfile()
}

func (self *appender2File) checkfile() error {
    self.check_count = 100
    if self.fd == nil {
        nfd, open_err := createLogFile(self.path, self.max, "")
        if open_err != nil {
            nfd.Close()
            return open_err
        }
        self.fd = nfd
        self.writer = bufio.NewWriter(self.fd)
    } else {
        fstat, err := self.fd.Stat()
        if err == nil && fstat.Size() <= self.max {
            return nil
        }
        self.writer.Flush()
        self.fd.Close()
        self.fd = nil

        nfd, open_err := createLogFile(self.path, self.max, "")
        if open_err != nil {
            nfd.Close()
            return open_err
        }
        self.fd = nfd
        self.writer = bufio.NewWriter(self.fd)
    }
    return nil
}

func (self *appender2File) close() {
    if self.fd != nil {
        self.writer.Flush()
        self.fd.Close()
    }
    return
}

func (self *appender2File) handle(msg *logMsg) error {
    self.check_count--
    self.writer.WriteString(msg.info)

    if self.check_count <= 0 {
        self.writer.Flush()
        err := self.checkfile()
        if err != nil {
            return err
        }
    }
    return nil
}

func (self *appender2File) setNext(n logHandler) {
    return
}<commit_msg>remove check<commit_after>package log

import (
    "bufio"
    "os"
)

type appender2File struct {
    path string
    max  int64

    fd     *os.File
    writer *bufio.Writer
}

func (self *appender2File) init() error {
    return self.checkfile()
}

func (self *appender2File) checkfile() error {
    if self.fd == nil {
        nfd, open_err := createLogFile(self.path, self.max, "")
        if open_err != nil {
            nfd.Close()
            return open_err
        }
        self.fd = nfd
        self.writer = bufio.NewWriter(self.fd)
    } else {
        fstat, err := self.fd.Stat()
        if err == nil && fstat.Size() <= self.max {
            return nil
        }
        self.writer.Flush()
        self.fd.Close()
        self.fd = nil

        nfd, open_err := createLogFile(self.path, self.max, "")
        if open_err != nil {
            nfd.Close()
            return open_err
        }
        self.fd = nfd
        self.writer = bufio.NewWriter(self.fd)
    }
    return nil
}

func (self *appender2File) close() {
    if self.fd != nil {
        self.writer.Flush()
        self.fd.Close()
    }
    return
}

func (self *appender2File) handle(msg *logMsg) error {
    self.writer.WriteString(msg.info)

    self.writer.Flush()
    err := self.checkfile()
    if err != nil {
        return err
    }

    return nil
}

func (self *appender2File) setNext(n logHandler) {
    return
}
{'fraction_non_alphanumeric': 0.12022965214454576, 'fraction_numerical': 0.006754474839581222, 'mean_word_length': 1.7476808905380334, 'pattern_counts': {'":': 0, '<': 6, '<?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': '2707186', 'n_tokens_mistral': 1001, 'n_tokens_neox': 986, 'n_words': 227}