LiterateConsole.create LiterateConsole.empty "console"
//then for example:
task {
Message.eventInfo "Client connected: {clientId}" |> Message.setField "clientId" conId |> writeLog
// do some other task related things
}
With F# 6, (FSharp.Core 6.0.5) the LiterateConsole starts to throw exceptions when it should write a parameter { in the message:
[12:45:50 INF] Client connected: Error in Logary console target rendering: System.InvalidCastException: Unable to cast object of type 'totalLensPartialIsomorphism@99-1[Logary.Value,System.String,Logary.Value]' to type 'Float'.
at Logary.Targets.LiterateConsole.LiterateFormatting.literateTokeniseField(LiterateConsoleConf conf, Property prop, Field propValue)
at Logary.Targets.LiterateConsole.LiterateFormatting.literateTokenisePointValue@366-3.Invoke(Token _arg2)
at Microsoft.FSharp.Collections.Internal.IEnumerator.map@75.DoMoveNext(b& curr) in D:\a\_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 78
at Microsoft.FSharp.Collections.Internal.IEnumerator.MapEnumerator`1.System.Collections.IEnumerator.MoveNext() in D:\a\_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 64
at Microsoft.FSharp.Core.CompilerServices.RuntimeHelpers.takeOuter@307[T,TResult](ConcatEnumerator`2 x, Unit unitVar0) in D:\a\_work\1\s\src\fsharp\FSharp.Core\seqcore.fs:line 308
at Logary.Targets.LiterateConsole.LiterateFormatting.literateDefaultTokeniser@444.GenerateNext(IEnumerable`1& next)
at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.MoveNextImpl() in D:\a\_work\1\s\src\fsharp\FSharp.Core\seqcore.fs:line 405
at Microsoft.FSharp.Collections.Internal.IEnumerator.map@75.DoMoveNext(b& curr) in D:\a\_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 77
at Microsoft.FSharp.Collections.Internal.IEnumerator.MapEnumerator`1.System.Collections.IEnumerator.MoveNext() in D:\a\_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 64
at Microsoft.FSharp.Collections.SeqModule.Iterate[T](FSharpFunc`2 action, IEnumerable`1 source) in D:\a\_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 496
at Logary.Targets.LiterateConsole.LiterateFormatting.consoleWriteLineColourParts(IEnumerable`1 parts)
at Logary.Targets.LiterateConsole.LiterateFormatting.consoleWriteColourPartsAtomically[a](a sem, IEnumerable`1 parts)
at Logary.Targets.LiterateConsole.empty@534-5.Invoke(Object sem, IEnumerable`1 parts)
at Hopac.Core.JobIsolate`1.DoJob(Worker& wr, Cont`1 xK)
at Hopac.Core.Worker.Run(Scheduler sr, Int32 me)
{ name = PointName [|"Util+logger@55-1"|]
value = Event "Client connected: {clientId}"
fields =
map
[(PointName [|"clientId"|],
Field (<fun:totalLensPartialIsomorphism@99-1>, None))]
context =
map
[("host", String "DESKTOP-ABC123");
("path", String "C:\git\mytest\bin")]
level = Info
timestamp = 1655466350260162300L }
More annoyingly, this affects to old versions, Logary 4.7.2 which says dependency [FSharp.Core] (>= 4.0.0.1) without upper restrictions.
The non-literate console and everything else seems to work fine.
Also, weirdly enough, the async version works:
async {
Message.eventInfo "Client connected: {clientId}" |> Message.setField "clientId" conId |> writeLog
// do some other task related things, Async.AwaitTask
} |> Async.StartAsTask
// Client connected: a12312a1-4308-1abc-bbea-1c236547ab1c
I'm using:
With F# 6, (FSharp.Core 6.0.5) the LiterateConsole starts to throw exceptions when it should write a parameter
{
in the message:More annoyingly, this affects to old versions, Logary 4.7.2 which says dependency [FSharp.Core] (>= 4.0.0.1) without upper restrictions.
The non-literate console and everything else seems to work fine.
Also, weirdly enough, the async version works: