提交 58d299eb 作者: Brian Tiger Chow

refactor(eventlog) rename ContextWithLoggable

License: MIT
Signed-off-by: 's avatarBrian Tiger Chow <brian@perfmode.com>

fix(eventlog) compilation error

License: MIT
Signed-off-by: 's avatarBrian Tiger Chow <brian@perfmode.com>
上级 08d709d2
......@@ -10,7 +10,7 @@ type key int
const metadataKey key = 0
func ContextWithMetadata(ctx context.Context, l Loggable) context.Context {
func ContextWithLoggable(ctx context.Context, l Loggable) context.Context {
existing, err := MetadataFromContext(ctx)
if err != nil {
// context does not contain meta. just set the new metadata
......
......@@ -10,7 +10,7 @@ func TestContextContainsMetadata(t *testing.T) {
t.Parallel()
m := Metadata{"foo": "bar"}
ctx := ContextWithMetadata(context.Background(), m)
ctx := ContextWithLoggable(context.Background(), m)
got, err := MetadataFromContext(ctx)
if err != nil {
t.Fatal(err)
......@@ -25,8 +25,8 @@ func TestContextContainsMetadata(t *testing.T) {
func TestContextWithPreexistingMetadata(t *testing.T) {
t.Parallel()
ctx := ContextWithMetadata(context.Background(), Metadata{"hello": "world"})
ctx = ContextWithMetadata(ctx, Metadata{"goodbye": "earth"})
ctx := ContextWithLoggable(context.Background(), Metadata{"hello": "world"})
ctx = ContextWithLoggable(ctx, Metadata{"goodbye": "earth"})
got, err := MetadataFromContext(ctx)
if err != nil {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论