Skip to content

Commit 059edb2

Browse files
committed
refactor: fix log message template
1 parent d0465b1 commit 059edb2

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/Enyim.Caching/Configuration/MemcachedClientConfiguration.cs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -108,25 +108,24 @@ public MemcachedClientConfiguration(
108108
var authenticationType = Type.GetType(options.Authentication.Type);
109109
if (authenticationType != null)
110110
{
111-
_logger.LogDebug($"Authentication type is {authenticationType}.");
111+
_logger.LogDebug("Authentication type is {authenticationType}.", authenticationType);
112112

113113
Authentication = new AuthenticationConfiguration();
114114
Authentication.Type = authenticationType;
115115
foreach (var parameter in options.Authentication.Parameters)
116116
{
117117
Authentication.Parameters[parameter.Key] = parameter.Value;
118-
_logger.LogDebug($"Authentication {parameter.Key} is '{parameter.Value}'.");
118+
_logger.LogDebug("Authentication {Key} is '{Value}'.", parameter.Key, parameter.Value);
119119
}
120120
}
121121
else
122122
{
123-
_logger.LogError($"Unable to load authentication type {options.Authentication.Type}.");
123+
_logger.LogError("Unable to load authentication type '{AuthenticationType}'.", options.Authentication.Type);
124124
}
125125
}
126126
catch (Exception ex)
127127
{
128-
_logger.LogError(new EventId(), ex,
129-
$"Unable to load authentication type {options.Authentication.Type}.");
128+
_logger.LogError(ex, "Unable to load authentication type '{AuthenticationType}'.", options.Authentication.Type);
130129
}
131130
}
132131

@@ -145,18 +144,18 @@ public MemcachedClientConfiguration(
145144
if (keyTransformerType != null)
146145
{
147146
KeyTransformer = Activator.CreateInstance(keyTransformerType) as IMemcachedKeyTransformer;
148-
_logger.LogDebug($"Use '{options.KeyTransformer}' KeyTransformer");
147+
_logger.LogDebug("Use '{KeyTransformer}' KeyTransformer", options.KeyTransformer);
149148
}
150149
}
151150
catch (Exception ex)
152151
{
153-
_logger.LogError(new EventId(), ex, $"Unable to load '{options.KeyTransformer}' KeyTransformer");
152+
_logger.LogError(ex, "Unable to load '{KeyTransformer}' KeyTransformer", options.KeyTransformer);
154153
}
155154
}
156155
else if (keyTransformer != null)
157156
{
158157
_keyTransformer = keyTransformer;
159-
_logger.LogDebug($"Use KeyTransformer Type : '{keyTransformer}'");
158+
_logger.LogDebug("Use KeyTransformer Type : '{keyTransformer}'", keyTransformer);
160159
}
161160

162161
if (!string.IsNullOrEmpty(options.Transcoder))
@@ -176,18 +175,18 @@ public MemcachedClientConfiguration(
176175
if (transcoderType != null)
177176
{
178177
Transcoder = Activator.CreateInstance(transcoderType) as ITranscoder;
179-
_logger.LogDebug($"Use '{options.Transcoder}'");
178+
_logger.LogDebug("Use '{Transcoder}'", options.Transcoder);
180179
}
181180
}
182181
catch (Exception ex)
183182
{
184-
_logger.LogError(new EventId(), ex, $"Unable to load '{options.Transcoder}'");
183+
_logger.LogError(new EventId(), ex, "Unable to load '{Transcoder}'", Transcoder);
185184
}
186185
}
187186
else if (transcoder != null)
188187
{
189188
_transcoder = transcoder;
190-
_logger.LogDebug($"Use Transcoder Type : '{transcoder}'");
189+
_logger.LogDebug("Use Transcoder Type : '{transcoder}'", transcoder);
191190
}
192191

193192
if (options.NodeLocatorFactory != null)

0 commit comments

Comments
 (0)