<commit_before>package main

import (
	"flag"
	"fmt"
	"log"
	"os"
	"os/signal"
	"strings"
	"time"

	"github.com/timeglass/glass/_vendor/github.com/hashicorp/errwrap"
	"github.com/timeglass/glass/_vendor/github.com/kardianos/service"

	"github.com/timeglass/glass/model"
	"github.com/timeglass/snow/monitor"
)

var Version = "0.0.0"
var Build = "gobuild"

var mbu = flag.Duration("mbu", time.Minute, "The minimal billable unit")
var bind = flag.String("bind", ":0", "Address to bind the Daemon to")
var force = flag.Bool("force", false, "Force start the Daemon")

var logger *Logger

func main() {
	flag.Parse()
	dir, err := os.Getwd()
	if err != nil {
		log.Fatal(errwrap.Wrapf("Failed to fetch current working dir: {{err}}", err))
	}

	logger, err = NewLogger(dir, os.Stderr)
	if err != nil {
		log.Fatal(errwrap.Wrapf("Failed to create logger: {{err}}", err))
	}

	//by default timeout is four times the mbu
	//@todo make configurable
	timer := NewTimer(*mbu, 4*(*mbu))
	svr, err := NewServer(*bind, timer)
	if err != nil {
		logger.Fatal(err)
	}

	//check version without delaying start times
	go svr.checkVersion()

	m := model.New(dir)
	monitor, err := monitor.New(dir, monitor.Recursive, time.Millisecond*50)
	if err != nil {
		logger.Fatal(errwrap.Wrapf(fmt.Sprintf("Failed to create monitor for directory '%s': {{err}}"), err))
	}

	go func() {
		for err := range monitor.Errors() {
			logger.Printf("Monitor Error: %s", err)
		}
	}()

	//whenever _something_ happens in any directory, wakeup the timer
	timer.Wakeup, err = monitor.Start()
	if err != nil {
		logger.Fatal(errwrap.Wrapf(fmt.Sprintf("Failed to start monitor for directory '%s': {{err}}"), err))
	}
<commit_msg>fixed error message [spent 9m0s]<commit_after>package main

import (
	"flag"
	"fmt"
	"log"
	"os"
	"os/signal"
	"strings"
	"time"

	"github.com/timeglass/glass/_vendor/github.com/hashicorp/errwrap"
	"github.com/timeglass/glass/_vendor/github.com/kardianos/service"

	"github.com/timeglass/glass/model"
	"github.com/timeglass/snow/monitor"
)

var Version = "0.0.0"
var Build = "gobuild"

var mbu = flag.Duration("mbu", time.Minute, "The minimal billable unit")
var bind = flag.String("bind", ":0", "Address to bind the Daemon to")
var force = flag.Bool("force", false, "Force start the Daemon")

var logger *Logger

func main() {
	flag.Parse()
	dir, err := os.Getwd()
	if err != nil {
		log.Fatal(errwrap.Wrapf("Failed to fetch current working dir: {{err}}", err))
	}

	logger, err = NewLogger(dir, os.Stderr)
	if err != nil {
		log.Fatal(errwrap.Wrapf("Failed to create logger: {{err}}", err))
	}

	//by default timeout is four times the mbu
	//@todo make configurable
	timer := NewTimer(*mbu, 4*(*mbu))
	svr, err := NewServer(*bind, timer)
	if err != nil {
		logger.Fatal(err)
	}

	//check version without delaying start times
	go svr.checkVersion()

	m := model.New(dir)
	monitor, err := monitor.New(dir, monitor.Recursive, time.Millisecond*50)
	if err != nil {
		logger.Fatal(errwrap.Wrapf(fmt.Sprintf("Failed to create monitor for directory '%s': {{err}}", dir), err))
	}

	go func() {
		for err := range monitor.Errors() {
			logger.Printf("Monitor Error: %s", err)
		}
	}()

	//whenever _something_ happens in any directory, wakeup the timer
	timer.Wakeup, err = monitor.Start()
	if err != nil {
		logger.Fatal(errwrap.Wrapf(fmt.Sprintf("Failed to start monitor for directory '%s': {{err}}"), err))
	}

{'fraction_non_alphanumeric': 0.16430678466076695, 'fraction_numerical': 0.00471976401179941, 'mean_word_length': 4.1692073170731705, 'pattern_counts': {'":': 2, '<': 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': '4185800', 'n_tokens_mistral': 1275, 'n_tokens_neox': 1223, 'n_words': 329}