<commit_before>// +build linux darwin freebsd

package cmd

import (
	"fmt"
	"log"
	"os"
	"strings"
	"time"
)

// ReturnCurrentUTC returns the current UTC time in RFC3339 format.
func ReturnCurrentUTC() string {
	t := time.Now().UTC()
	dateUpdated := (t.Format(time.RFC3339))
	return dateUpdated
}

// SetDirection returns the direction.
func SetDirection() string {
	direction := ""
	if strings.HasPrefix(os.Args[1], "-") {
		direction = "main"
	} else {
		direction = os.Args[1]
	}
	return direction
}

// Log adds the global Direction to a message and sends to syslog.
// Syslog is setup in main.go
func Log(message, priority string) {
	message = fmt.Sprintf("%s: %s", Direction, message)
	if Verbose {
		time := ReturnCurrentUTC()
		fmt.Printf("%s: %s\n", time, message)
	}
	switch {
	case priority == "debug":
		if os.Getenv("OCTO_DEBUG") != "" {
			log.Print(message)
		}
	default:
		log.Print(message)
	}
}

// GetHostname returns the hostname.<commit_msg>Fix edge case when you just loaded the binary and didn't have a command or a flag.<commit_after>// +build linux darwin freebsd

package cmd

import (
	"fmt"
	"log"
	"os"
	"strings"
	"time"
)

// ReturnCurrentUTC returns the current UTC time in RFC3339 format.
func ReturnCurrentUTC() string {
	t := time.Now().UTC()
	dateUpdated := (t.Format(time.RFC3339))
	return dateUpdated
}

// SetDirection returns the direction.
func SetDirection() string {
	args := fmt.Sprintf("%x", os.Args)
	direction := "main"
	if strings.ContainsAny(args, " ") {
		if strings.HasPrefix(os.Args[1], "-") {
			direction = "main"
		} else {
			direction = os.Args[1]
		}
	}
	return direction
}

// Log adds the global Direction to a message and sends to syslog.
// Syslog is setup in main.go
func Log(message, priority string) {
	message = fmt.Sprintf("%s: %s", Direction, message)
	if Verbose {
		time := ReturnCurrentUTC()
		fmt.Printf("%s: %s\n", time, message)
	}
	switch {
	case priority == "debug":
		if os.Getenv("OCTO_DEBUG") != "" {
			log.Print(message)
		}
	default:
		log.Print(message)
	}
}

// GetHostname returns the hostname.
{'fraction_non_alphanumeric': 0.14423076923076922, 'fraction_numerical': 0.009615384615384616, 'mean_word_length': 3.6764044943820227, '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': '5027068', 'n_tokens_mistral': 765, 'n_tokens_neox': 724, 'n_words': 211}