@@ -10,9 +10,9 @@ import (
1010
1111// DataSourceContext injects the data source type into logger contexts.
1212func DataSourceContext (ctx context.Context , dataSource string ) context.Context {
13- ctx = tfsdklog .With (ctx , KeyDataSourceType , dataSource )
14- ctx = tfsdklog .SubsystemWith (ctx , SubsystemProto , KeyDataSourceType , dataSource )
15- ctx = tflog .With (ctx , KeyDataSourceType , dataSource )
13+ ctx = tfsdklog .SetField (ctx , KeyDataSourceType , dataSource )
14+ ctx = tfsdklog .SubsystemSetField (ctx , SubsystemProto , KeyDataSourceType , dataSource )
15+ ctx = tflog .SetField (ctx , KeyDataSourceType , dataSource )
1616
1717 return ctx
1818}
@@ -41,16 +41,16 @@ func ProtoSubsystemContext(ctx context.Context, sdkOpts tfsdklog.Options) contex
4141
4242// ProtocolVersionContext injects the protocol version into logger contexts.
4343func ProtocolVersionContext (ctx context.Context , protocolVersion string ) context.Context {
44- ctx = tfsdklog .SubsystemWith (ctx , SubsystemProto , KeyProtocolVersion , protocolVersion )
44+ ctx = tfsdklog .SubsystemSetField (ctx , SubsystemProto , KeyProtocolVersion , protocolVersion )
4545
4646 return ctx
4747}
4848
4949// ProviderAddressContext injects the provider address into logger contexts.
5050func ProviderAddressContext (ctx context.Context , providerAddress string ) context.Context {
51- ctx = tfsdklog .With (ctx , KeyProviderAddress , providerAddress )
52- ctx = tfsdklog .SubsystemWith (ctx , SubsystemProto , KeyProviderAddress , providerAddress )
53- ctx = tflog .With (ctx , KeyProviderAddress , providerAddress )
51+ ctx = tfsdklog .SetField (ctx , KeyProviderAddress , providerAddress )
52+ ctx = tfsdklog .SubsystemSetField (ctx , SubsystemProto , KeyProviderAddress , providerAddress )
53+ ctx = tflog .SetField (ctx , KeyProviderAddress , providerAddress )
5454
5555 return ctx
5656}
@@ -63,27 +63,27 @@ func RequestIdContext(ctx context.Context) context.Context {
6363 reqID = "unable to assign request ID: " + err .Error ()
6464 }
6565
66- ctx = tfsdklog .With (ctx , KeyRequestID , reqID )
67- ctx = tfsdklog .SubsystemWith (ctx , SubsystemProto , KeyRequestID , reqID )
68- ctx = tflog .With (ctx , KeyRequestID , reqID )
66+ ctx = tfsdklog .SetField (ctx , KeyRequestID , reqID )
67+ ctx = tfsdklog .SubsystemSetField (ctx , SubsystemProto , KeyRequestID , reqID )
68+ ctx = tflog .SetField (ctx , KeyRequestID , reqID )
6969
7070 return ctx
7171}
7272
7373// ResourceContext injects the resource type into logger contexts.
7474func ResourceContext (ctx context.Context , resource string ) context.Context {
75- ctx = tfsdklog .With (ctx , KeyResourceType , resource )
76- ctx = tfsdklog .SubsystemWith (ctx , SubsystemProto , KeyResourceType , resource )
77- ctx = tflog .With (ctx , KeyResourceType , resource )
75+ ctx = tfsdklog .SetField (ctx , KeyResourceType , resource )
76+ ctx = tfsdklog .SubsystemSetField (ctx , SubsystemProto , KeyResourceType , resource )
77+ ctx = tflog .SetField (ctx , KeyResourceType , resource )
7878
7979 return ctx
8080}
8181
8282// RpcContext injects the RPC name into logger contexts.
8383func RpcContext (ctx context.Context , rpc string ) context.Context {
84- ctx = tfsdklog .With (ctx , KeyRPC , rpc )
85- ctx = tfsdklog .SubsystemWith (ctx , SubsystemProto , KeyRPC , rpc )
86- ctx = tflog .With (ctx , KeyRPC , rpc )
84+ ctx = tfsdklog .SetField (ctx , KeyRPC , rpc )
85+ ctx = tfsdklog .SubsystemSetField (ctx , SubsystemProto , KeyRPC , rpc )
86+ ctx = tflog .SetField (ctx , KeyRPC , rpc )
8787
8888 return ctx
8989}
0 commit comments