From 6d665db64af5cb4ed10d814035eb200dc0d7f6f7 Mon Sep 17 00:00:00 2001 From: Florian Verdonck Date: Sun, 31 Mar 2024 16:19:17 +0200 Subject: [PATCH] Purge it with fire (#1255) --- src/FsAutoComplete.Logging/FsLibLog.fs | 55 +------------------------- 1 file changed, 2 insertions(+), 53 deletions(-) diff --git a/src/FsAutoComplete.Logging/FsLibLog.fs b/src/FsAutoComplete.Logging/FsLibLog.fs index e45504d8c..7ff48103a 100644 --- a/src/FsAutoComplete.Logging/FsLibLog.fs +++ b/src/FsAutoComplete.Logging/FsLibLog.fs @@ -48,45 +48,9 @@ module Types = abstract member Log: Logger abstract member MappedContext: MappedContext -#if FABLE_COMPILER - // Fable doesn't support System.Collections.Generic.Stack, so this implementation (from FCS) - // is used instead. - type Stack<'a>() = - let mutable contents = Array.zeroCreate<'a> (2) - let mutable count = 0 - - member buf.Ensure newSize = - let oldSize = contents.Length - - if newSize > oldSize then - let old = contents - contents <- Array.zeroCreate (max newSize (oldSize * 2)) - Array.blit old 0 contents 0 count - - member buf.Count = count - - member buf.Pop() = - let item = contents.[count - 1] - count <- count - 1 - item - - member buf.Peep() = contents.[count - 1] - - member buf.Top(n) = [ for x in contents.[max 0 (count - n) .. count - 1] -> x ] |> List.rev - - member buf.Push(x) = - buf.Ensure(count + 1) - contents.[count] <- x - count <- count + 1 - - member buf.IsEmpty = (count = 0) -#endif - [] module Inner = -#if !FABLE_COMPILER open System.Collections.Generic -#endif /// /// DisposableStack on Dispose will call dispose on items appended to its stack in Last In First Out. @@ -310,8 +274,6 @@ module Types = /// The amended log. let setLogLevel (logLevel: LogLevel) (log: Log) = { log with LogLevel = logLevel } -#if !FABLE_COMPILER - let private formatterRegex = Regex(@"(?\d+)(?:(?[^}]+))?}(?!})", RegexOptions.Compiled) @@ -377,7 +339,6 @@ module Types = /// The log to amend. /// The amended log. let setMessageI (message: FormattableString) (log: Log) = setMessageInterpolated message log -#endif /// Provides operators to make writing logs more streamlined. module Operators = @@ -431,8 +392,6 @@ module Operators = /// The amended log with the parameter added. let (>>!!) log e = log >> Log.addException e - -#if !FABLE_COMPILER module Providers = module SerilogProvider = open System @@ -904,27 +863,20 @@ module Providers = let create () = MicrosoftProvider() :> ILogProvider -#endif module LogProvider = open System open Types -#if !FABLE_COMPILER open Providers -#endif open System.Diagnostics open Microsoft.FSharp.Quotations.Patterns let mutable private currentLogProvider = None let private knownProviders = - [ -#if !FABLE_COMPILER - (SerilogProvider.isAvailable, SerilogProvider.create) - (MicrosoftExtensionsLoggingProvider.isAvailable, MicrosoftExtensionsLoggingProvider.create) -#endif - ] + [ (SerilogProvider.isAvailable, SerilogProvider.create) + (MicrosoftExtensionsLoggingProvider.isAvailable, MicrosoftExtensionsLoggingProvider.create) ] /// Greedy search for first available LogProvider. Order of known providers matters. let private resolvedLogger = @@ -1024,7 +976,6 @@ module LogProvider = /// let inline getLoggerFor<'a> () = getLoggerByType (typeof<'a>) -#if !FABLE_COMPILER let rec private getModuleType = function | PropertyGet(_, propertyInfo, _) -> propertyInfo.DeclaringType @@ -1065,5 +1016,3 @@ type LogProvider = mi.DeclaringType.FullName.Split('+') |> Seq.tryHead |> Option.defaultValue "" sprintf "%s.%s" location memberName.Value |> LogProvider.getLoggerByName - -#endif