Skip to content

Commit 27ae151

Browse files
committed
csv writer unix_ms issue corrected
1 parent 93e5e63 commit 27ae151

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Writers/CSVWriter.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,15 @@ public bool Initialize() {
3939
counter++;
4040
}
4141

42+
// prepare columns
43+
List<string> _columns = new List<string>(columns);
44+
4245
eventWriter = new StreamWriter(new FileStream(filePath, FileMode.Create), Encoding.UTF8);
46+
4347
// Header Line, if any columns are added to `columns`
44-
if (columns.Count > 0) {
45-
if (writeUnixTime) columns.Insert(0,"unix_ms");
46-
eventWriter.WriteLine(String.Join(',', columns));
48+
if (_columns.Count > 0) {
49+
if (writeUnixTime) _columns.Insert(0,"unix_ms");
50+
eventWriter.WriteLine(String.Join(',', _columns));
4751
}
4852

4953
_is_active = true;
@@ -53,7 +57,7 @@ public bool Initialize() {
5357

5458
public bool WriteLine() {
5559
if (payload.Count == 0) return false;
56-
WriteLine(String.Join(",",payload));
60+
WriteLine(String.Join(",",payload), writeUnixTime);
5761
payload = new List<string>();
5862
return true;
5963
}

0 commit comments

Comments
 (0)