Skip to content

Commit 420e4a4

Browse files
Remove Log setup from fsx (#610)
1 parent 64e50b6 commit 420e4a4

File tree

1 file changed

+0
-38
lines changed

1 file changed

+0
-38
lines changed

src/FSharp.Formatting/FSharp.Formatting.fsx

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -17,41 +17,3 @@
1717
#r "FSharp.Formatting.CodeFormat.dll"
1818
#r "FSharp.Formatting.ApiDocs.dll"
1919

20-
// Setup Logging for FSharp.Formatting and FSharp.Formatting.Internal
21-
module Logging = FSharp.Formatting.Common.Log
22-
type TraceOptions = System.Diagnostics.TraceOptions
23-
24-
// By default, we log to console only. Other modes are enabled by setting
25-
// the `FSHARP_FORMATTING_LOG` environment variable.
26-
let logToFile, logToConsole =
27-
match System.Environment.GetEnvironmentVariable("FSHARP_FORMATTING_LOG") with
28-
| "ALL" -> true, true
29-
| "NONE" -> false, false
30-
| "FILE_ONLY" -> true, false
31-
| _ -> false, true
32-
33-
try
34-
let allTraceOptions =
35-
TraceOptions.Callstack ||| TraceOptions.DateTime ||| TraceOptions.LogicalOperationStack |||
36-
TraceOptions.ProcessId ||| TraceOptions.ThreadId ||| TraceOptions.Timestamp
37-
let noTraceOptions = TraceOptions.None
38-
let svclogFile = "FSharp.Formatting.svclog"
39-
System.Diagnostics.Trace.AutoFlush <- true
40-
41-
let setupListener listener =
42-
[ FSharp.Formatting.Common.Log.source
43-
FSharp.Formatting.Internal.Log.source ]
44-
|> Seq.iter (fun source ->
45-
source.Switch.Level <- System.Diagnostics.SourceLevels.All
46-
Logging.AddListener listener source)
47-
48-
if logToConsole then
49-
Logging.ConsoleListener()
50-
|> Logging.SetupListener noTraceOptions System.Diagnostics.SourceLevels.Verbose
51-
|> setupListener
52-
53-
// Test that everything works
54-
Logging.infof "FSharp.Formatting Logging setup!"
55-
FSharp.Formatting.Internal.Log.infof "FSharp.Formatting.Internal Logging setup!"
56-
with e ->
57-
printfn "FSharp.Formatting Logging setup failed: %A" e

0 commit comments

Comments
 (0)