Skip to content

Commit 0d2f040

Browse files
authored
Merge pull request #16 from akihikokuroda/filelogger
bug: add LogWorkflowRun logger
2 parents d7ec52e + 1678fe0 commit 0d2f040

File tree

5 files changed

+970
-0
lines changed

5 files changed

+970
-0
lines changed

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ require (
3131
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
3232
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
3333
github.com/yusufpapurcu/wmi v1.2.4 // indirect
34+
go.uber.org/multierr v1.11.0 // indirect
35+
go.uber.org/zap v1.27.0 // indirect
3436
golang.org/x/sys v0.25.0 // indirect
3537
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
3638
)

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ github.com/yosida95/uritemplate/v3 v3.0.2 h1:Ed3Oyj9yrmi9087+NczuL5BwkIc4wvTb5zI
7070
github.com/yosida95/uritemplate/v3 v3.0.2/go.mod h1:ILOh0sOhIJR3+L/8afwt/kE++YT040gmv5BQTMR2HP4=
7171
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
7272
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
73+
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
74+
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
75+
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
76+
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
7377
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
7478
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
7579
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=

internal/commands/run.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ type RunCommand struct {
2020
workflowFile string
2121
prompt bool
2222
mcpServerURI string
23+
logger common.FileLogger
2324
}
2425

2526
// NewRunCommand creates a new run command
@@ -43,13 +44,15 @@ func NewRunCommand() *cobra.Command {
4344
agentsFile = args[0]
4445
workflowFile = args[1]
4546
}
47+
filelogger, _ := common.NewFileLogger("")
4648

4749
runCmd := &RunCommand{
4850
BaseCommand: NewBaseCommand(options),
4951
agentsFile: agentsFile,
5052
workflowFile: workflowFile,
5153
prompt: prompt,
5254
mcpServerURI: mcpServerURI,
55+
logger: *filelogger,
5356
}
5457

5558
return runCmd.Run()
@@ -304,6 +307,18 @@ func (c *RunCommand) runWorkflow(workflow common.YAMLDocument, agents []common.Y
304307
// logWorkflowRun logs the workflow run
305308
func (c *RunCommand) logWorkflowRun(logger *common.Logger, workflowID, workflowName, prompt, output string, modelsUsed []string, status string, startTime, endTime time.Time, durationMs int) {
306309
c.Console().Ok(fmt.Sprintf("Workflow %s completed with status: %s", workflowID, status))
310+
311+
c.logger.LogWorkflowRun(
312+
workflowID,
313+
workflowName,
314+
prompt,
315+
output,
316+
modelsUsed,
317+
status,
318+
&startTime,
319+
&endTime,
320+
int64(durationMs),
321+
)
307322
}
308323

309324
// DeprecatedRunCommand deprecated create command

0 commit comments

Comments
 (0)