From 420e4a4eb3152fedd5ff647a68a73a5ea1fd79cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Chassaing?= Date: Mon, 28 Sep 2020 15:51:22 +0200 Subject: [PATCH] Remove Log setup from fsx (#610) --- src/FSharp.Formatting/FSharp.Formatting.fsx | 38 --------------------- 1 file changed, 38 deletions(-) diff --git a/src/FSharp.Formatting/FSharp.Formatting.fsx b/src/FSharp.Formatting/FSharp.Formatting.fsx index a0c8d0195..bcb1d3fd1 100644 --- a/src/FSharp.Formatting/FSharp.Formatting.fsx +++ b/src/FSharp.Formatting/FSharp.Formatting.fsx @@ -17,41 +17,3 @@ #r "FSharp.Formatting.CodeFormat.dll" #r "FSharp.Formatting.ApiDocs.dll" -// Setup Logging for FSharp.Formatting and FSharp.Formatting.Internal -module Logging = FSharp.Formatting.Common.Log -type TraceOptions = System.Diagnostics.TraceOptions - -// By default, we log to console only. Other modes are enabled by setting -// the `FSHARP_FORMATTING_LOG` environment variable. -let logToFile, logToConsole = - match System.Environment.GetEnvironmentVariable("FSHARP_FORMATTING_LOG") with - | "ALL" -> true, true - | "NONE" -> false, false - | "FILE_ONLY" -> true, false - | _ -> false, true - -try - let allTraceOptions = - TraceOptions.Callstack ||| TraceOptions.DateTime ||| TraceOptions.LogicalOperationStack ||| - TraceOptions.ProcessId ||| TraceOptions.ThreadId ||| TraceOptions.Timestamp - let noTraceOptions = TraceOptions.None - let svclogFile = "FSharp.Formatting.svclog" - System.Diagnostics.Trace.AutoFlush <- true - - let setupListener listener = - [ FSharp.Formatting.Common.Log.source - FSharp.Formatting.Internal.Log.source ] - |> Seq.iter (fun source -> - source.Switch.Level <- System.Diagnostics.SourceLevels.All - Logging.AddListener listener source) - - if logToConsole then - Logging.ConsoleListener() - |> Logging.SetupListener noTraceOptions System.Diagnostics.SourceLevels.Verbose - |> setupListener - - // Test that everything works - Logging.infof "FSharp.Formatting Logging setup!" - FSharp.Formatting.Internal.Log.infof "FSharp.Formatting.Internal Logging setup!" -with e -> - printfn "FSharp.Formatting Logging setup failed: %A" e