-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implemented all the IExecutionLogger strategies
- Loading branch information
1 parent
84fdb8d
commit 55b7995
Showing
9 changed files
with
116 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/FubuMVC.Core/Diagnostics/Instrumentation/ProductionExecutionLogger.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace FubuMVC.Core.Diagnostics.Instrumentation | ||
{ | ||
public class ProductionExecutionLogger : IExecutionLogger | ||
{ | ||
private readonly IExecutionLogStorage _storage; | ||
|
||
public ProductionExecutionLogger(IExecutionLogStorage storage) | ||
{ | ||
_storage = storage; | ||
} | ||
|
||
public void Record(IChainExecutionLog log, IDictionary<string, object> http) | ||
{ | ||
log.RecordHeaders(http); | ||
_storage.Store(log); | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/FubuMVC.Core/Diagnostics/Instrumentation/VerboseExecutionLogger.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace FubuMVC.Core.Diagnostics.Instrumentation | ||
{ | ||
public class VerboseExecutionLogger : IExecutionLogger | ||
{ | ||
private readonly IExecutionLogStorage _storage; | ||
|
||
public VerboseExecutionLogger(IExecutionLogStorage storage) | ||
{ | ||
_storage = storage; | ||
} | ||
|
||
public void Record(IChainExecutionLog log, IDictionary<string, object> http) | ||
{ | ||
log.RecordHeaders(http); | ||
log.RecordBody(http); | ||
|
||
_storage.Store(log); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/FubuMVC.Tests/Diagnostics/Instrumentation/ProductionExecutionLoggerTester.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System.Collections.Generic; | ||
using FubuMVC.Core.Diagnostics.Instrumentation; | ||
using FubuMVC.Tests.TestSupport; | ||
using NUnit.Framework; | ||
using Rhino.Mocks; | ||
|
||
namespace FubuMVC.Tests.Diagnostics.Instrumentation | ||
{ | ||
[TestFixture] | ||
public class ProductionExecutionLoggerTester : InteractionContext<ProductionExecutionLogger> | ||
{ | ||
[Test] | ||
public void record() | ||
{ | ||
var log = MockFor<IChainExecutionLog>(); | ||
var env = new Dictionary<string, object>(); | ||
|
||
ClassUnderTest.Record(log, env); | ||
|
||
log.AssertWasCalled(x => x.RecordHeaders(env)); | ||
log.AssertWasNotCalled(x => x.RecordBody(env)); | ||
|
||
MockFor<IExecutionLogStorage>().AssertWasCalled(x => x.Store(log)); | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/FubuMVC.Tests/Diagnostics/Instrumentation/VerboseExecutionLoggerTester.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System.Collections.Generic; | ||
using FubuMVC.Core.Diagnostics.Instrumentation; | ||
using FubuMVC.Tests.TestSupport; | ||
using NUnit.Framework; | ||
using Rhino.Mocks; | ||
|
||
namespace FubuMVC.Tests.Diagnostics.Instrumentation | ||
{ | ||
[TestFixture] | ||
public class VerboseExecutionLoggerTester : InteractionContext<VerboseExecutionLogger> | ||
{ | ||
[Test] | ||
public void record() | ||
{ | ||
var log = MockFor<IChainExecutionLog>(); | ||
var env = new Dictionary<string, object>(); | ||
|
||
ClassUnderTest.Record(log, env); | ||
|
||
log.AssertWasCalled(x => x.RecordHeaders(env)); | ||
log.AssertWasCalled(x => x.RecordBody(env)); | ||
|
||
MockFor<IExecutionLogStorage>().AssertWasCalled(x => x.Store(log)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters