Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updated [ThreadAgnostic] handling for CSV layout

  • Loading branch information...
commit 871ca9f6fb35d30663c49468227a43009d90ae2b 1 parent f405c7e
@jkowalski authored
View
1  src/NLog/Layouts/CsvColumn.cs
@@ -39,6 +39,7 @@ namespace NLog.Layouts
/// A column in the CSV.
/// </summary>
[NLogConfigurationItem]
+ [ThreadAgnostic]
public class CsvColumn
{
/// <summary>
View
1  src/NLog/Layouts/CsvLayout.cs
@@ -298,6 +298,7 @@ private string GetHeader()
/// <summary>
/// Header for CSV layout.
/// </summary>
+ [ThreadAgnostic]
private class CsvHeaderLayout : Layout
{
private CsvLayout parent;
View
34 tests/NLog.UnitTests/Layouts/ThreadAgnosticTests.cs
@@ -149,5 +149,39 @@ public void ComplexNonAgnosticWithCondition()
l.Initialize(null);
Assert.IsFalse(l.IsThreadAgnostic);
}
+
+ [Test]
+ public void CsvThreadAgnostic()
+ {
+ CsvLayout l = new CsvLayout()
+ {
+ Columns =
+ {
+ new CsvColumn("name1", "${message}"),
+ new CsvColumn("name2", "${level}"),
+ new CsvColumn("name3", "${longdate}"),
+ },
+ };
+
+ l.Initialize(null);
+ Assert.IsTrue(l.IsThreadAgnostic);
+ }
+
+ [Test]
+ public void CsvNonAgnostic()
+ {
+ CsvLayout l = new CsvLayout()
+ {
+ Columns =
+ {
+ new CsvColumn("name1", "${message}"),
+ new CsvColumn("name2", "${threadname}"),
+ new CsvColumn("name3", "${longdate}"),
+ },
+ };
+
+ l.Initialize(null);
+ Assert.IsFalse(l.IsThreadAgnostic);
+ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.