mirror of
https://github.com/hanzoai/agents.git
synced 2026-10-30 18:48:36 +00:00
Transforms hanzoai/agents from a marketplace config repo into a full agent orchestration platform by merging the AgentField infrastructure: - Go control plane (K8s-like agent orchestration, service mesh, DAG workflows) - Python SDK (FastAPI-based agent framework, LiteLLM, memory, DID/VC) - TypeScript SDK (@hanzo/agents - Vercel AI SDK, MCP, workflows) - Go SDK (idiomatic agent builder + client) - React 19 embedded dashboard (XyFlow DAGs, Recharts, Radix UI) - Docker/K8s/Helm deployment configs - Examples: hello world, deep research, RAG, simulation, benchmarks - Functional test suite across Python/Go/TypeScript All references rebranded: AgentField → Hanzo Agents - Module: github.com/hanzoai/agents/control-plane - Python: hanzo_agents - TypeScript: @hanzo/agents - Go: github.com/hanzoai/agents/sdk/go - Env vars: HANZO_AGENTS_* - Config: hanzo-agents.yaml Previous marketplace configs moved to config/ directory.
56 lines
1.4 KiB
Go
56 lines
1.4 KiB
Go
package logger
|
|
|
|
import (
|
|
"bytes"
|
|
"encoding/json"
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/rs/zerolog"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestInitLoggerSetsLevel(t *testing.T) {
|
|
InitLogger(false)
|
|
require.Equal(t, zerolog.InfoLevel, Logger.GetLevel())
|
|
|
|
InitLogger(true)
|
|
require.Equal(t, zerolog.DebugLevel, Logger.GetLevel())
|
|
}
|
|
|
|
func TestFormattedHelpers(t *testing.T) {
|
|
var buf bytes.Buffer
|
|
Logger = zerolog.New(&buf).With().Timestamp().Logger().Level(zerolog.DebugLevel)
|
|
|
|
Infof("hello %s", "world")
|
|
Debugf("debug %d", 1)
|
|
Warnf("warn %s", "value")
|
|
Errorf("error %s", "value")
|
|
Successf("done %d", 2)
|
|
|
|
lines := strings.Split(strings.TrimSpace(buf.String()), "\n")
|
|
require.Len(t, lines, 5)
|
|
|
|
messages := make([]map[string]interface{}, 0, len(lines))
|
|
for _, line := range lines {
|
|
entry := make(map[string]interface{})
|
|
require.NoError(t, json.Unmarshal([]byte(line), &entry))
|
|
messages = append(messages, entry)
|
|
}
|
|
|
|
require.Equal(t, "info", messages[0]["level"])
|
|
require.Equal(t, "hello world", messages[0]["message"])
|
|
|
|
require.Equal(t, "debug", messages[1]["level"])
|
|
require.Equal(t, "debug 1", messages[1]["message"])
|
|
|
|
require.Equal(t, "warn", messages[2]["level"])
|
|
require.Equal(t, "warn value", messages[2]["message"])
|
|
|
|
require.Equal(t, "error", messages[3]["level"])
|
|
require.Equal(t, "error value", messages[3]["message"])
|
|
|
|
require.Equal(t, "info", messages[4]["level"])
|
|
require.Equal(t, "✅ done 2", messages[4]["message"])
|
|
}
|