Skip to content

Commit 0f7f56a

Browse files
committed
Add process id to log messages
1 parent 8d6feeb commit 0f7f56a

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/TypedCssClasses.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TargetFramework>netstandard2.0</TargetFramework>
55
<DisableImplicitSystemValueTupleReference>true</DisableImplicitSystemValueTupleReference>
66
<Configurations>Debug;Release;ReleaseTest</Configurations>
7-
<VersionPrefix>0.3.0</VersionPrefix>
7+
<VersionPrefix>0.3.1</VersionPrefix>
88
<VersionSuffix></VersionSuffix>
99
<PackageId>Zanaptak.TypedCssClasses</PackageId>
1010
<Authors>zanaptak</Authors>

src/vendor/FSharp.Data/IO.fs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ open Zanaptak.TypedCssClasses.Internal.FSharp.Data
1717
let private logLock = obj()
1818
let mutable private indentation = 0
1919
let private logFileTypePaths = ConcurrentDictionary< string , string >()
20+
let private processId = System.Diagnostics.Process.GetCurrentProcess().Id
2021

2122
let internal enableLogType typeName filePath =
2223
logFileTypePaths.AddOrUpdate( typeName , filePath , fun _ _ -> filePath ) |> ignore
@@ -39,9 +40,12 @@ let private appendToLogType typeName line =
3940

4041
let internal logType typeName str =
4142
if isLogEnabledType typeName then
42-
DateTime.Now.ToString( "yyyy-MM-dd HH:mm:ss.fff" ) +
43-
" [" + Threading.Thread.CurrentThread.ManagedThreadId.ToString() + "]" +
44-
" " + String(' ', indentation * 2) + str
43+
sprintf "%s [%i][%i] %s %s"
44+
( DateTime.Now.ToString( "yyyy-MM-dd HH:mm:ss.fff" ) )
45+
processId
46+
Threading.Thread.CurrentThread.ManagedThreadId
47+
( String(' ', indentation * 4) )
48+
str
4549
|> appendToLogType typeName
4650

4751
let internal logfType typeName fmt = Printf.kprintf ( logType typeName ) fmt

0 commit comments

Comments
 (0)