Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Commit 0b0112f

Browse files
Merge pull request #69 from thefringeninja/structured-logs
Use Structured Logging
2 parents 4c1a7cc + 3dacb49 commit 0b0112f

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

src/SqlStreamStore.Server/Browser/SqlStreamStoreBrowserMiddleware.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ public static IApplicationBuilder UseSqlStreamStoreBrowser(
2222
.Where(name => name.StartsWith(typeof(SqlStreamStoreBrowserMiddleware).Namespace));
2323

2424
Log.Debug(
25-
$"The following embedded resources were found and will be served as static content: {string.Join(", ", staticFiles)}");
25+
"The following embedded resources were found and will be served as static content: {staticFiles}",
26+
string.Join(", ", staticFiles));
2627

2728
return builder.Use(IndexPage).UseStaticFiles(new StaticFileOptions
2829
{

src/SqlStreamStore.Server/SqlStreamStoreFactory.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public Task<IStreamStore> Create(CancellationToken cancellationToken = default)
4646
var provider = _configuration.Provider?.ToLowerInvariant()
4747
?? inmemory;
4848

49-
Log.Information($"Creating stream store for provider '{provider}'");
49+
Log.Information("Creating stream store for provider {provider}", provider);
5050

5151
if (!s_factories.TryGetValue(provider, out var factory))
5252
{
@@ -170,13 +170,14 @@ async Task<bool> DatabaseExists()
170170
private static void SchemaCreationFailed(Func<string> getSchemaCreationScript, Exception ex)
171171
=> Log.Warning(
172172
new StringBuilder()
173-
.Append($"Could not create schema: {ex.Message}")
173+
.Append("Could not create schema: {ex}")
174174
.AppendLine()
175175
.Append(
176176
"Does your connection string have enough permissions? If not, run the following sql script as a privileged user:")
177177
.AppendLine()
178-
.Append(getSchemaCreationScript())
178+
.Append("{script}")
179179
.ToString(),
180-
ex);
180+
ex,
181+
getSchemaCreationScript());
181182
}
182183
}

0 commit comments

Comments
 (0)