Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/common-go/log/context.go
2498 views
1
// Copyright (c) 2023 Gitpod GmbH. All rights reserved.
2
// Licensed under the GNU Affero General Public License (AGPL).
3
// See License.AGPL.txt in the project root for license information.
4
5
package log
6
7
import (
8
"context"
9
10
"github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus/ctxlogrus"
11
"github.com/sirupsen/logrus"
12
)
13
14
func Extract(ctx context.Context) *logrus.Entry {
15
return ctxlogrus.Extract(ctx)
16
}
17
18
func AddFields(ctx context.Context, fields logrus.Fields) {
19
ctxlogrus.AddFields(ctx, fields)
20
}
21
22
func ToContext(ctx context.Context, entry *logrus.Entry) context.Context {
23
return ctxlogrus.ToContext(ctx, entry)
24
}
25
26