<commit_before>// See the online help (-h) for detailed information.
// To learn how to add a target see the documentation in target.go.
package main

import (
	"fmt"
	"io"
	"os"
	"path"
	"strconv"
	"strings"
	"time"

	"github.com/jlinoff/go/msg"
)

// Log is the package logger. It writes to os.Stdout and, optionally, a file
// if -t is specified.
var Log *msg.Object

func main() {
	opts := NewCliOptions()
	if opts.Quiet {
		Log.DebugEnabled = false
		Log.InfoEnabled = false
		Log.WarningEnabled = false
	}

	// Create the tee file, if necessary.
	tee := ""
	if opts.Tee {
		t := time.Now().Truncate(time.Millisecond).Format("20060102-150505")
		b := path.Base(os.Args[0])
		tee = fmt.Sprintf("%v-%v-%v.log", b, Context.UserName, t)
		Log.Info("tee file : %v", tee)
		fp, err := os.Create(tee)
		if err != nil {
			Log.Err("unable to open log file: %v", tee)
		}
		Log.Writers = []io.Writer{os.Stdout, fp}
		defer fp.Close()
	}

	// Display the run-time context.
	MakeContext(tee)
	if opts.RecipesDir != "" {
		Context.RecipeDir = opts.RecipesDir
	}
	Context.PrintContext()

	// Define the pre-defined environment variables.
	// Defining them here makes them available for recipes, help and
	// run operations.
	setenv := func(name string, val string) {
		vname := strings.ToUpper(fmt.Sprintf("%v_%v", Context.Base, name))
		Log.Info("built-in env var %v=%v", vname, val)
		os.Setenv(vname, val)
	}
	setenv("base", Context.Base)
	setenv("builddate", Context.MakeBuildDate)<commit_msg>Fixed tee file name generation bug<commit_after>// See the online help (-h) for detailed information.
// To learn how to add a target see the documentation in target.go.
package main

import (
	"fmt"
	"io"
	"os"
	"os/user"
	"path"
	"strconv"
	"strings"
	"time"

	"github.com/jlinoff/go/msg"
)

// Log is the package logger. It writes to os.Stdout and, optionally, a file
// if -t is specified.
var Log *msg.Object

func main() {
	opts := NewCliOptions()
	if opts.Quiet {
		Log.DebugEnabled = false
		Log.InfoEnabled = false
		Log.WarningEnabled = false
	}

	// Create the tee file, if necessary.
	tee := ""
	if opts.Tee {
		t := time.Now().Truncate(time.Millisecond).Format("20060102-150505")
		b := path.Base(os.Args[0])
		u, _ := user.Current()
		tee = fmt.Sprintf("%v-%v-%v.log", b, t, u.Username)
		Log.Info("tee file : %v", tee)
		fp, err := os.Create(tee)
		if err != nil {
			Log.Err("unable to open log file: %v", tee)
		}
		Log.Writers = []io.Writer{os.Stdout, fp}
		defer fp.Close()
	}

	// Display the run-time context.
	MakeContext(tee)
	if opts.RecipesDir != "" {
		Context.RecipeDir = opts.RecipesDir
	}
	Context.PrintContext()

	// Define the pre-defined environment variables.
	// Defining them here makes them available for recipes, help and
	// run operations.
	setenv := func(name string, val string) {
		vname := strings.ToUpper(fmt.Sprintf("%v_%v", Context.Base, name))
		Log.Info("built-in env var %v=%v", vname, val)
		os.Setenv(vname, val)
	}
	setenv("base", Context.Base)
	setenv("builddate", Context.MakeBuildDate)
{'fraction_non_alphanumeric': 0.1541762958071971, 'fraction_numerical': 0.009904258831297457, 'mean_word_length': 3.4558823529411766, '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': '7411119', 'n_tokens_mistral': 1172, 'n_tokens_neox': 1096, 'n_words': 311}