Skip to content

Commit

Permalink
Better way of adding logging to internal NpgsqlDataSource. Closes GH-…
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremydmiller committed Feb 28, 2024
1 parent 4d9f119 commit fc6b110
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Marten/StoreOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,18 @@ public StoreOptions()
ResiliencePipeline = strategy;

#endregion

// Add logging into our NpgsqlDataSource
NpgsqlDataSourceFactory = new DefaultNpgsqlDataSourceFactory(connectionString =>
{
var builder = new NpgsqlDataSourceBuilder(connectionString);
if (LogFactory != null)
{
builder.UseLoggerFactory(LogFactory);
}

return builder;
});
}

/// <summary>
Expand Down Expand Up @@ -334,7 +346,7 @@ public ITenancy Tenancy

private Lazy<ITenancy>? _tenancy;
private Func<string, NpgsqlDataSourceBuilder> _npgsqlDataSourceBuilderFactory = DefaultNpgsqlDataSourceBuilderFactory;
private INpgsqlDataSourceFactory _npgsqlDataSourceFactory = new DefaultNpgsqlDataSourceFactory();
private INpgsqlDataSourceFactory _npgsqlDataSourceFactory;
private readonly IList<Type> _compiledQueryTypes = new List<Type>();
private int _applyChangesLockId = 4004;
private bool _shouldApplyChangesOnStartup = false;
Expand Down

0 comments on commit fc6b110

Please sign in to comment.