Skip to content

Commit

Permalink
More cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
manio143 committed Feb 2, 2025
1 parent 62ff1cc commit adc71c2
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 10 deletions.
20 changes: 14 additions & 6 deletions src/Excos.Platform.Common/Marten/StoreConfigurationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ namespace Excos.Platform.Common.Marten;

public static class StoreConfigurationExtensions
{
/// <summary>
/// Adds a Marten store for the custom <typeparamref name="TStore"/> interface and prepares it to work with Wolverine
/// with multi-tenancy support.
/// </summary>
/// <typeparam name="TStore">Custom data store interface</typeparam>
/// <param name="build">Host builder</param>
/// <param name="dbSchemaName">Database schema name for the store, also used for wolverine subscriptions and keyed services.</param>
/// <param name="configureOptions">Extra configuration</param>
public static IHostApplicationBuilder AddExcosMartenStore<TStore>(
this IHostApplicationBuilder builder,
string dbSchemaName,
Expand All @@ -36,12 +44,12 @@ public static IHostApplicationBuilder AddExcosMartenStore<TStore>(
/// Adds a Marten store for the custom <typeparamref name="TStore"/> interface and prepares it to work with Wolverine
/// with multi-tenancy support.
/// </summary>
/// <typeparam name="TStore"></typeparam>
/// <param name="services"></param>
/// <param name="hostEnvironment"></param>
/// <param name="configuration"></param>
/// <param name="dbSchemaName"></param>
/// <param name="configureOptions"></param>
/// <typeparam name="TStore">Custom data store interface</typeparam>
/// <param name="services">Dependency injection services collection</param>
/// <param name="hostEnvironment">Environment</param>
/// <param name="configuration">Configuration</param>
/// <param name="dbSchemaName">Database schema name for the store, also used for wolverine subscriptions and keyed services.</param>
/// <param name="configureOptions">Extra configuration</param>
/// <returns></returns>
public static IServiceCollection AddExcosMartenStore<TStore>(
this IServiceCollection services,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

namespace Excos.Platform.Common.Wolverine.Telemetry;

/// <summary>
/// Add event fields logging on the current activity for all event handlers.
/// </summary>
public class EventLoggingPolicy : IHandlerPolicy
{
public void Apply(IReadOnlyList<HandlerChain> chains, GenerationRules rules, IServiceContainer container)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,20 @@ namespace Excos.Platform.Common.Wolverine.Telemetry
{
public static class LoggingEventHandlerExtensions
{
/// <summary>
/// Add an event handler which will log event details.
/// </summary>
/// <typeparam name="T">Event type</typeparam>
public static HandlerDiscovery AddLogger<T>(this HandlerDiscovery discovery)
{
return discovery.IncludeType(typeof(LoggingEventHandler<T>));
}
}

/// <summary>
/// An event hadnler which logs event details.
/// </summary>
/// <typeparam name="T">Event type</typeparam>
public static class LoggingEventHandler<T>
{
public static void Handle(T message, Envelope envelope, ILogger<T> logger, PrivacyValueRedactor redactor)
Expand All @@ -32,7 +40,6 @@ public static void Handle(T message, Envelope envelope, ILogger<T> logger, Priva
{
{ "EnvelopeId", envelope.Id },
{ "ConversationId", envelope.ConversationId == Guid.Empty ? null : envelope.ConversationId },
// { "CorrelationId", envelope.CorrelationId }, this is just trace id so it's stamped on logs anyways
{ "TenantId", envelope.TenantId },
{ "Source", envelope.Source },
{ "SentAt", envelope.SentAt },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
<PackageReference Include="WolverineFx.Marten" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Excos.Platform.Common\Excos.Platform.Common.csproj" />
</ItemGroup>

<PropertyGroup>
<ContainerRepository>excos</ContainerRepository>
<ContainerImageTags>latest;$(InformationalVersion)</ContainerImageTags>
Expand All @@ -26,8 +30,5 @@
<ItemGroup>
<ContainerPort Include="80" Type="tcp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Excos.Platform.Common\Excos.Platform.Common.csproj" />
</ItemGroup>

</Project>

0 comments on commit adc71c2

Please sign in to comment.