-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests: more robust logging for failed containers, destroy test container before startup
- Loading branch information
Showing
3 changed files
with
41 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace VahterBanBot.Tests | ||
|
||
open System | ||
open Microsoft.Extensions.Logging | ||
|
||
type StringLogger() = | ||
let lockObj = obj() | ||
let messages = ResizeArray<string>() | ||
interface ILogger with | ||
member this.BeginScope _ = null | ||
member this.IsEnabled _ = true | ||
member this.Log(logLevel, _eventId, state, ex, formatter) = | ||
lock lockObj (fun() -> | ||
messages.Add($"[{logLevel}] {formatter.Invoke(state, ex)}")) | ||
|
||
member _.ExtractMessages(): string = lock lockObj (fun() -> String.Join("\n", messages)) |
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