Skip to content

Commit 8c7c37f

Browse files
committed
refactor: Add logging for script generation process in LLM providers to enhance visibility
1 parent 82a6b6f commit 8c7c37f

File tree

5 files changed

+14
-0
lines changed

5 files changed

+14
-0
lines changed

internal/llm/claude.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ func NewClaudeProvider(config ClaudeConfig) (*ClaudeProvider, error) {
2828
// GenerateScripts creates a main script and test script from a natural language description
2929
func (p *ClaudeProvider) GenerateScripts(ctx context.Context, description string) (ScriptPair, error) {
3030
// First generate the main script
31+
log.Info("Generating main script...")
3132
mainPrompt := p.formatPrompt(FeatureScriptPrompt, description)
3233
mainScript, err := p.generate(ctx, mainPrompt)
3334
if err != nil {
@@ -37,6 +38,7 @@ func (p *ClaudeProvider) GenerateScripts(ctx context.Context, description string
3738
log.Debug("Main script generated:\n%s", mainScript)
3839

3940
// Then generate the test script
41+
log.Info("Generating test script...")
4042
testPrompt := p.formatPrompt(TestScriptPrompt, mainScript, description)
4143
testScript, err := p.generate(ctx, testPrompt)
4244
if err != nil {

internal/llm/ollama.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ func NewOllamaProvider(config OllamaConfig) (*OllamaProvider, error) {
2828
// GenerateScripts creates a main script and test script from a natural language description
2929
func (p *OllamaProvider) GenerateScripts(ctx context.Context, description string) (ScriptPair, error) {
3030
// First generate the main script
31+
log.Info("Generating main script...")
3132
mainPrompt := p.formatPrompt(FeatureScriptPrompt, description)
3233
mainScript, err := p.generate(ctx, mainPrompt)
3334
if err != nil {
@@ -37,6 +38,7 @@ func (p *OllamaProvider) GenerateScripts(ctx context.Context, description string
3738
log.Debug("Main script generated:\n%s", mainScript)
3839

3940
// Then generate the test script
41+
log.Info("Generating test script...")
4042
testPrompt := p.formatPrompt(TestScriptPrompt, mainScript, description)
4143
testScript, err := p.generate(ctx, testPrompt)
4244
if err != nil {

internal/llm/openai.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ func NewOpenAIProvider(config OpenAIConfig) (*OpenAIProvider, error) {
2828
// GenerateScripts creates a main script and test script from a natural language description
2929
func (p *OpenAIProvider) GenerateScripts(ctx context.Context, description string) (ScriptPair, error) {
3030
// First generate the main script
31+
log.Info("Generating main script...")
3132
mainPrompt := p.formatPrompt(FeatureScriptPrompt, description)
3233
mainScript, err := p.generate(ctx, mainPrompt)
3334
if err != nil {
@@ -37,6 +38,7 @@ func (p *OpenAIProvider) GenerateScripts(ctx context.Context, description string
3738
log.Debug("Main script generated:\n%s", mainScript)
3839

3940
// Then generate the test script
41+
log.Info("Generating test script...")
4042
testPrompt := p.formatPrompt(TestScriptPrompt, mainScript, description)
4143
testScript, err := p.generate(ctx, testPrompt)
4244
if err != nil {

internal/log/log.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ func SetLevel(l Level) {
3939
level = l
4040
}
4141

42+
// GetLevel returns the current logging level
43+
func GetLevel() Level {
44+
return getLevel()
45+
}
46+
4247
func getLevel() Level {
4348
levelLock.RLock()
4449
defer levelLock.RUnlock()

internal/script/pipeline.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,5 +156,8 @@ func (p *Pipeline) runTestScript(ctx context.Context, scripts llm.ScriptPair) er
156156
return fmt.Errorf("test script failed: %w\nOutput:\n%s", err, output)
157157
}
158158

159+
// Log test script output in verbose mode
160+
log.Debug("Test script output:\n%s", output)
161+
159162
return nil
160163
}

0 commit comments

Comments
 (0)