Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
4404175
Removed obsolete type
WhitWaldo Oct 27, 2024
662b620
Added missing using
WhitWaldo Oct 27, 2024
cf876c0
Adding interface for IWorkflowContext for replayability concerns
WhitWaldo Oct 27, 2024
be5340a
Removed unused IConfiguration
WhitWaldo Oct 27, 2024
fcdeadf
Added ReplaySafeLogger type
WhitWaldo Oct 27, 2024
bcea844
Building out functionality to expose ReplayLogger in workflow context
WhitWaldo Oct 27, 2024
0a871f5
Added license information to file
WhitWaldo Dec 19, 2024
2a77908
Removed unnecessary file
WhitWaldo Dec 19, 2024
1d11d40
Updated copyright header for different project, made some tweaks for …
WhitWaldo Dec 19, 2024
ed19f04
Added virtual methods that use the already-available ILoggerFactory t…
WhitWaldo Dec 19, 2024
04a77a2
Removed unnecessary registration
WhitWaldo Dec 19, 2024
283e98d
Updated example to demonstrate using ReplaySafeLogger in the orchestr…
WhitWaldo Dec 19, 2024
182d58e
Tweaks on visibility and abstraction so that the methods are availabl…
WhitWaldo Dec 19, 2024
5f4a41b
Merge branch 'workflow-replay-logger' into workflow-logger
WhitWaldo Dec 19, 2024
3d6641e
Removed obsolete type registrations
WhitWaldo Dec 19, 2024
78ad0da
Simplified argument null check
WhitWaldo Dec 19, 2024
1d3f06f
Removed since-removed code leftover from merge
WhitWaldo Dec 19, 2024
4f32540
Added documentation demonstrating how to access the replay-safe logger
WhitWaldo Dec 19, 2024
53da1d8
Removed unnecessary and separate ReplaySafeLogger in favor of method …
WhitWaldo Dec 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Building out functionality to expose ReplayLogger in workflow context
Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
  • Loading branch information
WhitWaldo committed Oct 27, 2024
commit bcea8442e7858521c43c2262ab10aff83f99fad9
19 changes: 19 additions & 0 deletions src/Dapr.Workflow/DaprWorkflowContextExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Microsoft.Extensions.Logging;

namespace Dapr.Workflow;

/// <summary>
/// Defines convenient overloads for calling context methods.
/// </summary>
public static class DaprWorkflowContextExtensions
{
/// <summary>
/// Returns an instance of <see cref="ILogger"/> that is replay safe, ensuring the logger logs only
/// when the orchestrator is not replaying that line of code.
/// </summary>
/// <param name="context">The workflow context.</param>
/// <param name="logger">An instance of <see cref="ILogger"/>.</param>
/// <returns>An instance of a replay-safe <see cref="ILogger"/>.</returns>
public static ILogger CreateReplaySafeLogger(this IWorkflowContext context, ILogger logger) =>
new ReplaySafeLogger(logger, context);
}
2 changes: 2 additions & 0 deletions src/Dapr.Workflow/WorkflowServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public static IServiceCollection AddDaprWorkflow(
serviceCollection.AddHttpClient();

serviceCollection.AddHostedService<WorkflowLoggingService>();

serviceCollection.TryAddSingleton<ILogger, ReplaySafeLogger>();
serviceCollection.TryAddSingleton<DaprWorkflowClient>();
serviceCollection.AddDaprClient();

Expand Down