@@ -71,19 +71,19 @@ type Logger [<ImportingConstructor>] ([<Import(typeof<SVsServiceProvider>)>] ser
7171 match self.FSharpLoggingPane, msgType with
7272 | None, _ -> ()
7373 | Some pane, LogType.Message ->
74- String.Format( " [F#][ {0}{1}] {2}{3}" , " " , time, msg, Environment.NewLine)
74+ String.Format( " [{0}{1}] {2}{3}" , " " , time, msg, Environment.NewLine)
7575 |> pane.OutputString
7676 |> ignore
7777 | Some pane, LogType.Info ->
78- String.Format( " [F#][ {0}{1}] {2}{3}" , " INFO " , time, msg, Environment.NewLine)
78+ String.Format( " [{0}{1}] {2}{3}" , " INFO " , time, msg, Environment.NewLine)
7979 |> pane.OutputString
8080 |> ignore
8181 | Some pane, LogType.Warn ->
82- String.Format( " [F#][ {0}{1}] {2}{3}" , " WARN " , time, msg, Environment.NewLine)
82+ String.Format( " [{0}{1}] {2}{3}" , " WARN " , time, msg, Environment.NewLine)
8383 |> pane.OutputString
8484 |> ignore
8585 | Some pane, LogType.Error ->
86- String.Format( " [F#][ {0}{1}] {2}{3}" , " ERROR " , time, msg, Environment.NewLine)
86+ String.Format( " [{0}{1}] {2}{3}" , " ERROR " , time, msg, Environment.NewLine)
8787 |> pane.OutputString
8888 |> ignore
8989
@@ -112,3 +112,34 @@ module Logging =
112112
113113 let logExceptionWithContext ( ex : Exception , context ) =
114114 logErrorf " Context: %s \n Exception Message: %s \n Stack Trace: %s " context ex.Message ex.StackTrace
115+
116+ module Activity =
117+ let listen filter =
118+ let indent ( activity : Activity ) =
119+ let rec loop ( activity : Activity ) n =
120+ if activity.Parent <> null then
121+ loop ( activity.Parent) ( n + 1 )
122+ else
123+ n
124+
125+ String.replicate ( loop activity 0 ) " "
126+
127+ let collectTags ( activity : Activity ) =
128+ [ for tag in activity.Tags -> $" {tag.Key}: %A {tag.Value}" ]
129+ |> String.concat " , "
130+
131+ let listener =
132+ new ActivityListener(
133+ ShouldListenTo = ( fun source -> source.Name = FSharp.Compiler.Diagnostics.ActivityNames.FscSourceName),
134+ Sample =
135+ ( fun context ->
136+ if context.Name.Contains( filter) then
137+ ActivitySamplingResult.AllDataAndRecorded
138+ else
139+ ActivitySamplingResult.None),
140+ ActivityStarted = ( fun a -> logMsg $" {indent a}{a.OperationName} {collectTags a}" )
141+ )
142+
143+ ActivitySource.AddActivityListener( listener)
144+
145+ let listenToAll () = listen " "
0 commit comments