<commit_before>package agent

import (
	"github.com/appio/watchdog/watchdog"
	"sync"
)

// Agent starts and manages the Watchdog instance.
type Agent struct {
	dog *watchdog.Watchdog

	// shutdownCh is used for shutdowns
	shutdown     bool
	shutdownCh   chan struct{}
	shutdownLock sync.Mutex
}

func NewAgent(config *Config) *Agent {
	return &Agent{
		dog:        watchdog.New(),
		shutdownCh: make(chan struct{}),
	}
}

func (a *Agent) Start() error {
	return nil
}

func (a *Agent) Shutdown() error {
	return nil
}

// ShutdownCh returns a channel that can be selected to wait
// for the agent to perform a shutdown.
func (a *Agent) ShutdownCh() <-chan struct{} {
	return a.shutdownCh
}<commit_msg>Configured logging on agent<commit_after>package agent

import (
	"github.com/appio/watchdog/watchdog"
	"io"
	"log"
	"os"
	"sync"
)

// Agent starts and manages the Watchdog instance.
type Agent struct {
	// logger instance wraps the logOutput
	logger *log.Logger

	dog *watchdog.Watchdog

	// shutdownCh is used for shutdowns
	shutdown     bool
	shutdownCh   chan struct{}
	shutdownLock sync.Mutex
}

func NewAgent(config *Config, logOutput io.Writer) *Agent {
	// Ensure we have a log sink
	if logOutput == nil {
		logOutput = os.Stderr
	}

	return &Agent{
		dog:        watchdog.New(),
		logger:     log.New(logOutput, "", log.LstdFlags),
		shutdownCh: make(chan struct{}),
	}
}

func (a *Agent) Start() error {
	a.logger.Println("[INFO] Watchdog starting...")

	return nil
}

func (a *Agent) Shutdown() error {
	a.logger.Println("[INFO] Gracefully shutting down...")
	return a.dog.Shutdown()
}

// ShutdownCh returns a channel that can be selected to wait
// for the agent to perform a shutdown.
func (a *Agent) ShutdownCh() <-chan struct{} {
	return a.shutdownCh
}
{'fraction_non_alphanumeric': 0.11751412429378531, 'fraction_numerical': 0.0, 'mean_word_length': 3.588082901554404, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3587605', 'n_tokens_mistral': 618, 'n_tokens_neox': 596, 'n_words': 194}