@@ -116,7 +116,7 @@ public Task<string> OnConnectedAsync(ILogger? log = null, bool sendTracerIfConne
116116 {
117117 async Task < string > IfConnectedAsync ( ILogger ? log , bool sendTracerIfConnected , bool autoConfigureIfConnected )
118118 {
119- log ? . LogInformation ( $ " { Format . ToString ( this ) } : OnConnectedAsync already connected start" ) ;
119+ log ? . LogInformationOnConnectedAsyncAlreadyConnectedStart ( new ( this ) ) ;
120120 if ( autoConfigureIfConnected )
121121 {
122122 await AutoConfigureAsync ( null , log ) . ForAwait ( ) ;
@@ -125,15 +125,15 @@ async Task<string> IfConnectedAsync(ILogger? log, bool sendTracerIfConnected, bo
125125 {
126126 await SendTracerAsync ( log ) . ForAwait ( ) ;
127127 }
128- log ? . LogInformation ( $ " { Format . ToString ( this ) } : OnConnectedAsync already connected end" ) ;
128+ log ? . LogInformationOnConnectedAsyncAlreadyConnectedEnd ( new ( this ) ) ;
129129 return "Already connected" ;
130130 }
131131
132132 if ( ! IsConnected )
133133 {
134- log ? . LogInformation ( $ " { Format . ToString ( this ) } : OnConnectedAsync init (State= { interactive ? . ConnectionState } )" ) ;
134+ log ? . LogInformationOnConnectedAsyncInit ( new ( this ) , interactive ? . ConnectionState ) ;
135135 var tcs = new TaskCompletionSource < string > ( TaskCreationOptions . RunContinuationsAsynchronously ) ;
136- _ = tcs . Task . ContinueWith ( t => log ? . LogInformation ( $ " { Format . ToString ( this ) } : OnConnectedAsync completed ( { t . Result } )" ) ) ;
136+ _ = tcs . Task . ContinueWith ( t => log ? . LogInformationOnConnectedAsyncCompleted ( new ( this ) , t . Result ) ) ;
137137 lock ( _pendingConnectionMonitors )
138138 {
139139 _pendingConnectionMonitors . Add ( tcs ) ;
@@ -383,7 +383,7 @@ internal async Task AutoConfigureAsync(PhysicalConnection? connection, ILogger?
383383 return ;
384384 }
385385
386- log ? . LogInformation ( $ " { Format . ToString ( this ) } : Auto-configuring..." ) ;
386+ log ? . LogInformationAutoConfiguring ( new ( this ) ) ;
387387
388388 var commandMap = Multiplexer . CommandMap ;
389389 const CommandFlags flags = CommandFlags . FireAndForget | CommandFlags . NoRedirect ;
@@ -458,7 +458,7 @@ internal async Task AutoConfigureAsync(PhysicalConnection? connection, ILogger?
458458 // But if GETs are disabled on this, do not fail the connection - we just don't get tiebreaker benefits
459459 if ( Multiplexer . RawConfig . TryGetTieBreaker ( out var tieBreakerKey ) && Multiplexer . CommandMap . IsAvailable ( RedisCommand . GET ) )
460460 {
461- log ? . LogInformation ( $ " { Format . ToString ( EndPoint ) } : Requesting tie-break (Key= \" { tieBreakerKey } \" )..." ) ;
461+ log ? . LogInformationRequestingTieBreak ( new LoggerExtensions . EndPointLogValue ( EndPoint ) , tieBreakerKey . ToString ( ) ) ;
462462 msg = Message . Create ( 0 , flags , RedisCommand . GET , tieBreakerKey ) ;
463463 msg . SetInternalCall ( ) ;
464464 msg = LoggingMessage . Create ( log , msg ) ;
@@ -929,7 +929,7 @@ internal ValueTask WriteDirectOrQueueFireAndForgetAsync<T>(PhysicalConnection? c
929929
930930 private async Task HandshakeAsync ( PhysicalConnection connection , ILogger ? log )
931931 {
932- log ? . LogInformation ( $ " { Format . ToString ( this ) } : Server handshake" ) ;
932+ log ? . LogInformationServerHandshake ( new ( this ) ) ;
933933 if ( connection == null )
934934 {
935935 Multiplexer . Trace ( "No connection!?" ) ;
@@ -979,7 +979,7 @@ private async Task HandshakeAsync(PhysicalConnection connection, ILogger? log)
979979 ResultProcessor < bool > ? autoConfig = null ;
980980 if ( Multiplexer . RawConfig . TryResp3 ( ) ) // note this includes an availability check on HELLO
981981 {
982- log ? . LogInformation ( $ " { Format . ToString ( this ) } : Authenticating via HELLO" ) ;
982+ log ? . LogInformationAuthenticatingViaHello ( new ( this ) ) ;
983983 var hello = Message . CreateHello ( 3 , user , password , clientName , CommandFlags . FireAndForget ) ;
984984 hello . SetInternalCall ( ) ;
985985 await WriteDirectOrQueueFireAndForgetAsync ( connection , hello , autoConfig ??= ResultProcessor . AutoConfigureProcessor . Create ( log ) ) . ForAwait ( ) ;
@@ -997,14 +997,14 @@ private async Task HandshakeAsync(PhysicalConnection connection, ILogger? log)
997997 // and: we're pipelined here, so... meh
998998 if ( ! string . IsNullOrWhiteSpace ( user ) && Multiplexer . CommandMap . IsAvailable ( RedisCommand . AUTH ) )
999999 {
1000- log ? . LogInformation ( $ " { Format . ToString ( this ) } : Authenticating (user/password)" ) ;
1000+ log ? . LogInformationAuthenticatingUserPassword ( new ( this ) ) ;
10011001 msg = Message . Create ( - 1 , CommandFlags . FireAndForget , RedisCommand . AUTH , ( RedisValue ) user , ( RedisValue ) password ) ;
10021002 msg . SetInternalCall ( ) ;
10031003 await WriteDirectOrQueueFireAndForgetAsync ( connection , msg , ResultProcessor . DemandOK ) . ForAwait ( ) ;
10041004 }
10051005 else if ( ! string . IsNullOrWhiteSpace ( password ) && Multiplexer . CommandMap . IsAvailable ( RedisCommand . AUTH ) )
10061006 {
1007- log ? . LogInformation ( $ " { Format . ToString ( this ) } : Authenticating (password)" ) ;
1007+ log ? . LogInformationAuthenticatingPassword ( new ( this ) ) ;
10081008 msg = Message . Create ( - 1 , CommandFlags . FireAndForget , RedisCommand . AUTH , ( RedisValue ) password ) ;
10091009 msg . SetInternalCall ( ) ;
10101010 await WriteDirectOrQueueFireAndForgetAsync ( connection , msg , ResultProcessor . DemandOK ) . ForAwait ( ) ;
@@ -1014,7 +1014,7 @@ private async Task HandshakeAsync(PhysicalConnection connection, ILogger? log)
10141014 {
10151015 if ( ! string . IsNullOrWhiteSpace ( clientName ) )
10161016 {
1017- log ? . LogInformation ( $ " { Format . ToString ( this ) } : Setting client name: { clientName } " ) ;
1017+ log ? . LogInformationSettingClientName ( new ( this ) , clientName ) ;
10181018 msg = Message . Create ( - 1 , CommandFlags . FireAndForget , RedisCommand . CLIENT , RedisLiterals . SETNAME , ( RedisValue ) clientName ) ;
10191019 msg . SetInternalCall ( ) ;
10201020 await WriteDirectOrQueueFireAndForgetAsync ( connection , msg , ResultProcessor . DemandOK ) . ForAwait ( ) ;
@@ -1024,7 +1024,7 @@ private async Task HandshakeAsync(PhysicalConnection connection, ILogger? log)
10241024 {
10251025 // note that this is a relatively new feature, but usually we won't know the
10261026 // server version, so we will use this speculatively and hope for the best
1027- log ? . LogInformation ( $ " { Format . ToString ( this ) } : Setting client lib/ver" ) ;
1027+ log ? . LogInformationSettingClientLibVer ( new ( this ) ) ;
10281028
10291029 var libName = Multiplexer . GetFullLibraryName ( ) ;
10301030 if ( ! string . IsNullOrWhiteSpace ( libName ) )
@@ -1062,7 +1062,7 @@ private async Task HandshakeAsync(PhysicalConnection connection, ILogger? log)
10621062
10631063 var tracer = GetTracerMessage ( true ) ;
10641064 tracer = LoggingMessage . Create ( log , tracer ) ;
1065- log ? . LogInformation ( $ " { Format . ToString ( this ) } : Sending critical tracer (handshake): { tracer . CommandAndKey } " ) ;
1065+ log ? . LogInformationSendingCriticalTracer ( new ( this ) , tracer . CommandAndKey ) ;
10661066 await WriteDirectOrQueueFireAndForgetAsync ( connection , tracer , ResultProcessor . EstablishConnection ) . ForAwait ( ) ;
10671067
10681068 // Note: this **must** be the last thing on the subscription handshake, because after this
@@ -1077,7 +1077,7 @@ private async Task HandshakeAsync(PhysicalConnection connection, ILogger? log)
10771077 await WriteDirectOrQueueFireAndForgetAsync ( connection , msg , ResultProcessor . TrackSubscriptions ) . ForAwait ( ) ;
10781078 }
10791079 }
1080- log ? . LogInformation ( $ " { Format . ToString ( this ) } : Flushing outbound buffer" ) ;
1080+ log ? . LogInformationFlushingOutboundBuffer ( new ( this ) ) ;
10811081 await connection . FlushAsync ( ) . ForAwait ( ) ;
10821082 }
10831083
0 commit comments