Skip to content

Commit

Permalink
add logging to tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
matthid committed Nov 21, 2015
1 parent c7f0e40 commit e33b758
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/FSharp.Literate.Tests/FSharp.Literate.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@
<Project>{341ebf32-d470-4c55-99e9-55f14f7ffbb1}</Project>
<Private>True</Private>
</ProjectReference>
<ProjectReference Include="..\..\src\FSharp.Formatting.Common\FSharp.Formatting.Common.fsproj">
<Name>FSharp.Formatting.Common</Name>
<Project>{91bad90e-bf3b-4646-a1a7-1568f8f25075}</Project>
<Private>True</Private>
</ProjectReference>
<ProjectReference Include="..\..\src\FSharp.Literate\FSharp.Literate.fsproj">
<Name>FSharp.Literate</Name>
<Project>{65e6d541-0486-4383-b619-5cfc5d2ba2f0}</Project>
Expand Down
24 changes: 24 additions & 0 deletions tests/FSharp.Literate.Tests/Tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,30 @@ open FSharp.Markdown.Unit
open NUnit.Framework
open FSharp.Literate.Tests.Setup


module Logging = FSharp.Formatting.Common.Log
type TraceOptions = System.Diagnostics.TraceOptions
do
try
System.Diagnostics.Trace.AutoFlush <- true
let allTraceOptions = TraceOptions.Callstack ||| TraceOptions.DateTime ||| TraceOptions.LogicalOperationStack |||
TraceOptions.ProcessId ||| TraceOptions.ThreadId ||| TraceOptions.Timestamp
let noTraceOptions = TraceOptions.None
let listeners =
[|Logging.ConsoleListener()
|> Logging.SetupListener noTraceOptions System.Diagnostics.SourceLevels.Information |]
let sources =
[ FSharp.Formatting.Common.Log.source
Yaaf.FSharp.Scripting.Log.source ]

sources |> Seq.iter (Logging.SetupSource listeners)

// Test that everything works
Logging.infof "FSharp.Formatting Logging setup!"
Yaaf.FSharp.Scripting.Log.infof "Yaaf.FSharp.Scripting Logging setup!"
with e ->
printfn "FSharp.Formatting Logging setup failed: %A" e

let properNewLines (text: string) = text.Replace("\r\n", System.Environment.NewLine)

// --------------------------------------------------------------------------------------
Expand Down

0 comments on commit e33b758

Please sign in to comment.