Skip to content

Commit 6aa60b6

Browse files
committed
Added timing to indent scopes
1 parent 38b0c36 commit 6aa60b6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

GitVersionCore/Logger.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
namespace GitVersion
22
{
33
using System;
4+
using System.Globalization;
45

56
public static class Logger
67
{
@@ -17,12 +18,13 @@ static Logger()
1718

1819
public static IDisposable IndentLog(string operationDescription)
1920
{
21+
var start = DateTime.Now;
2022
indent = indent + " ";
2123
WriteInfo("Begin: " + operationDescription);
2224
return new ActionDisposable(() =>
2325
{
2426
indent = indent.Substring(0, indent.Length - 2);
25-
WriteInfo("End: " + operationDescription);
27+
WriteInfo(string.Format(CultureInfo.InvariantCulture, "End: {0} (Took: {1:N}ms)", operationDescription, DateTime.Now.Subtract(start).TotalMilliseconds));
2628
});
2729
}
2830

@@ -35,7 +37,7 @@ public static void SetLoggers(Action<string> info, Action<string> warn, Action<s
3537

3638
static Action<string> LogMessage(Action<string> logAction, string level)
3739
{
38-
return s => logAction(string.Format("{0}{1} [{2:MM/dd/yy H:mm:ss:ff}] {3}", indent, level, DateTime.Now, s));
40+
return s => logAction(string.Format(CultureInfo.InvariantCulture, "{0}{1} [{2:MM/dd/yy H:mm:ss:ff}] {3}", indent, level, DateTime.Now, s));
3941
}
4042

4143
public static void Reset()

0 commit comments

Comments
 (0)