mirror of
https://github.com/fleetdm/fleet
synced 2026-05-10 10:40:46 +00:00
<!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #38607 Contributor docs update: https://github.com/fleetdm/fleet/pull/39285/changes Another contributor docs update: https://github.com/fleetdm/fleet/pull/39402/changes Also: - renamed OtelHandler to OtelTracingHandler - made "opentelemetry" be the default when tracing is enabled - updated OTEL dependencies # Checklist for submitter - [x] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. ## Testing - [x] Added/updated automated tests - [x] QA'd all new/changed functionality manually ## New Fleet configuration settings - [x] Setting(s) is/are explicitly excluded from GitOps <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added OpenTelemetry log export capability, enabling logs to be sent to OpenTelemetry collectors. * New configuration option `logging.otel_logs_enabled` (requires tracing to be enabled). * **Chores** * Updated OpenTelemetry dependencies to v1.40.0 with latest OTLP exporters and logging support. * Updated dependencies including gRPC (v1.78.0), Google libraries, and cryptography packages. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
28 lines
679 B
Go
28 lines
679 B
Go
package logging
|
|
|
|
import (
|
|
"log/slog"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/fleetdm/fleet/v4/server/platform/logging/testutils"
|
|
)
|
|
|
|
func TestMultiHandler(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
handler1 := testutils.NewTestHandler()
|
|
handler2 := testutils.NewTestHandler()
|
|
logger := slog.New(NewMultiHandler(handler1, handler2))
|
|
|
|
logger.InfoContext(t.Context(), "test message", "key", "value")
|
|
|
|
record1 := handler1.LastRecord()
|
|
record2 := handler2.LastRecord()
|
|
require.NotNil(t, record1)
|
|
require.NotNil(t, record2)
|
|
assert.Equal(t, "test message", record1.Message)
|
|
assert.Equal(t, "test message", record2.Message)
|
|
}
|