Skip to content

Commit

Permalink
#821 Change default log date/time format by cutting ten thousandths o…
Browse files Browse the repository at this point in the history
…f a second
  • Loading branch information
YevgeniyShunevych committed Feb 7, 2024
1 parent e7c7827 commit 73aa1d2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Atata/BrowserLogging/LoggingBrowserLogHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ public LoggingBrowserLogHandler(ILogManager logManager) =>
_logManager = logManager;

public void Handle(BrowserLogEntry entry) =>
_logManager.Trace($"Browser log: {entry.Timestamp:HH:mm:ss.ffff} {entry.Level.ToString(TermCase.Upper)} {entry.Message}");
_logManager.Trace($"Browser log: {entry.Timestamp:HH:mm:ss.fff} {entry.Level.ToString(TermCase.Upper)} {entry.Message}");
}
2 changes: 1 addition & 1 deletion src/Atata/Logging/NLogFileConsumer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class NLogFileConsumer : LazyInitializableLogConsumer, ICloneable
/// <summary>
/// Gets or sets the layout of log event.
/// </summary>
public string Layout { get; set; } = "${shortdate} ${time} ${uppercase:${level}:padding=5} ${message}${onexception:inner= }${exception:format=toString}";
public string Layout { get; set; } = @"${date:format=yyyy-MM-dd HH\:mm\:ss.fff} ${uppercase:${level}:padding=5} ${message}${onexception:inner= }${exception:format=toString}";

/// <inheritdoc/>
protected override dynamic GetLogger()
Expand Down
4 changes: 2 additions & 2 deletions src/Atata/Logging/TextOutputLogConsumer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public TextOutputLogConsumer(Action<string> writeAction) =>

/// <summary>
/// Gets or sets the timestamp format.
/// The default value is <c>"yyyy-MM-dd HH:mm:ss.ffff"</c>.
/// The default value is <c>"yyyy-MM-dd HH:mm:ss.fff"</c>.
/// </summary>
public string TimestampFormat { get; set; } = "yyyy-MM-dd HH:mm:ss.ffff";
public string TimestampFormat { get; set; } = "yyyy-MM-dd HH:mm:ss.fff";

public void Log(LogEventInfo eventInfo)
{
Expand Down
2 changes: 1 addition & 1 deletion test/Atata.IntegrationTests/NLog.config
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<target xsi:type="File"
name="File"
fileName="${event-properties:artifacts}/${event-properties:test-name-sanitized}.log"
layout="${shortdate} ${time} ${uppercase:${level}:padding=5} ${message}${onexception:inner= }${exception:format=toString}"
layout="${date:format=yyyy-MM-dd HH\:mm\:ss.fff} ${uppercase:${level}:padding=5} ${message}${onexception:inner= }${exception:format=toString}"
encoding="UTF-8"
keepFileOpen="false">
</target>
Expand Down

0 comments on commit 73aa1d2

Please sign in to comment.