uniform logging

This commit is contained in:
Ettore Di Giacinto
2024-04-19 00:02:00 +02:00
parent 2cba2eafe6
commit 08563c3286
13 changed files with 178 additions and 108 deletions

View File

@@ -3,7 +3,8 @@ package agent_test
import (
"context"
"fmt"
"log/slog"
"github.com/mudler/local-agent-framework/xlog"
"github.com/mudler/local-agent-framework/action"
. "github.com/mudler/local-agent-framework/agent"
@@ -20,13 +21,13 @@ var _ Action = &TestAction{}
var debugOptions = []JobOption{
WithReasoningCallback(func(state ActionCurrentState) bool {
slog.Info("Reasoning", state)
xlog.Info("Reasoning", state)
return true
}),
WithResultCallback(func(state ActionState) {
slog.Info("Reasoning", state.Reasoning)
slog.Info("Action", state.Action)
slog.Info("Result", state.Result)
xlog.Info("Reasoning", state.Reasoning)
xlog.Info("Action", state.Action)
xlog.Info("Result", state.Result)
}),
}
@@ -197,13 +198,13 @@ var _ = Describe("Agent test", func() {
EnableHUD,
EnableStandaloneJob,
WithAgentReasoningCallback(func(state ActionCurrentState) bool {
slog.Info("Reasoning", state)
xlog.Info("Reasoning", state)
return true
}),
WithAgentResultCallback(func(state ActionState) {
slog.Info("Reasoning", state.Reasoning)
slog.Info("Action", state.Action)
slog.Info("Result", state.Result)
xlog.Info("Reasoning", state.Reasoning)
xlog.Info("Action", state.Action)
xlog.Info("Result", state.Result)
}),
WithActions(
&FakeInternetAction{