mirror of
https://github.com/gitpod-io/gitpod.git
synced 2025-12-08 17:36:30 +00:00
* [common-go] Composable log fields * add test for compose * use in public api * fix * fix
31 lines
765 B
Go
31 lines
765 B
Go
// Copyright (c) 2023 Gitpod GmbH. All rights reserved.
|
|
// Licensed under the GNU Affero General Public License (AGPL).
|
|
// See License.AGPL.txt in the project root for license information.
|
|
|
|
package log
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/sirupsen/logrus"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestCompose(t *testing.T) {
|
|
fields := Compose(
|
|
WorkspaceOwner("owner"),
|
|
WorkspaceID("workspace"),
|
|
WorkspaceInstanceID("instance"),
|
|
ProjectID("project"),
|
|
OrganizationID("org"),
|
|
)
|
|
require.Equal(t, logrus.Fields{
|
|
OwnerIDField: "owner",
|
|
OrganizationIDField: "org",
|
|
TeamIDField: "org",
|
|
ProjectIDField: "project",
|
|
WorkspaceInstanceIDField: "instance",
|
|
WorkspaceIDField: "workspace",
|
|
}, fields)
|
|
}
|