<commit_before>package main

import (
	"crypto/tls"
	"fmt"

	"gopkg.in/gomail.v2"
)

func SendStatusMail(options *Options) {
	logContent := Log.String()

	if options.statusMailOptions.smtpHost == "" ||
		options.statusMailOptions.smtpPort == 0 ||
		options.statusMailOptions.smtpUsername == "" ||
		options.statusMailOptions.smtpPassword == "" {
		if len(options.statusMailOptions.recipients) > 0 {
			Log.Warn.Println("Status mail recipients given, but SMTP configuration is incomplete.")
		} else {
			Log.Debug.Println("No SMTP configuration given.")
		}

		return
	}

	var logLevel string
	if fatalBuf.Len() > 0 {
		logLevel = "FATAL"
	} else if errorBuf.Len() > 0 {
		logLevel = "ERROR"
	} else if errorBuf.Len() > 0 {
		logLevel = "WARN"
	} else {
		logLevel = "INFO"
	}

	m := gomail.NewMessage()
	m.SetHeader("From", options.statusMailOptions.from)
	m.SetHeader("To", options.statusMailOptions.recipients...)
	m.SetHeader("Subject", fmt.Sprintf("rotating-rsync-backup [%s]: %s", logLevel, options.profileName))
	m.SetBody("text/plain", logContent)

	d := gomail.NewDialer(
		options.statusMailOptions.smtpHost,
		options.statusMailOptions.smtpPort,
		options.statusMailOptions.smtpUsername,
		options.statusMailOptions.smtpPassword,
	)
	if options.statusMailOptions.smtpInsecure {
		d.TLSConfig = &tls.Config{InsecureSkipVerify: true}
	}
<commit_msg>feat(mails): log when sending status mail<commit_after>package main

import (
	"crypto/tls"
	"fmt"

	"gopkg.in/gomail.v2"
)

func SendStatusMail(options *Options) {
	logContent := Log.String()

	if options.statusMailOptions.smtpHost == "" ||
		options.statusMailOptions.smtpPort == 0 ||
		options.statusMailOptions.smtpUsername == "" ||
		options.statusMailOptions.smtpPassword == "" {
		if len(options.statusMailOptions.recipients) > 0 {
			Log.Warn.Println("Status mail recipients given, but SMTP configuration is incomplete.")
		} else {
			Log.Debug.Println("No SMTP configuration given.")
		}

		return
	}

	Log.Info.Printf("Sending status mail to: %v", options.statusMailOptions.recipients)

	var logLevel string
	if fatalBuf.Len() > 0 {
		logLevel = "FATAL"
	} else if errorBuf.Len() > 0 {
		logLevel = "ERROR"
	} else if errorBuf.Len() > 0 {
		logLevel = "WARN"
	} else {
		logLevel = "INFO"
	}

	m := gomail.NewMessage()
	m.SetHeader("From", options.statusMailOptions.from)
	m.SetHeader("To", options.statusMailOptions.recipients...)
	m.SetHeader("Subject", fmt.Sprintf("rotating-rsync-backup [%s]: %s", logLevel, options.profileName))
	m.SetBody("text/plain", logContent)

	d := gomail.NewDialer(
		options.statusMailOptions.smtpHost,
		options.statusMailOptions.smtpPort,
		options.statusMailOptions.smtpUsername,
		options.statusMailOptions.smtpPassword,
	)
	if options.statusMailOptions.smtpInsecure {
		d.TLSConfig = &tls.Config{InsecureSkipVerify: true}
	}

{'fraction_non_alphanumeric': 0.1392226148409894, 'fraction_numerical': 0.004240282685512367, 'mean_word_length': 4.550980392156863, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '5165339', 'n_tokens_mistral': 1064, 'n_tokens_neox': 977, 'n_words': 177}