File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -171,18 +171,18 @@ public struct JSONLogger : LogHandler {
171
171
#"}"#
172
172
) . utf8)
173
173
}
174
- let dataNoSeparator = prefix + jsonLine + suffix
174
+ let lineDataNoSeparator = prefix + jsonLine + suffix
175
175
176
176
/* We lock, because the writeAll function might split the write in more than 1 write
177
177
* (if the write system call only writes a part of the data).
178
178
* If another part of the program writes to fd, we might get interleaved data,
179
179
* because they cannot be aware of our lock (and we cannot be aware of theirs if they have one). */
180
180
JSONLogger . lock. withLock {
181
- let prefix : Data
182
- if Self . isFirstLog { prefix = Data ( ) ; Self . isFirstLog = false }
183
- else { prefix = lineSeparator}
181
+ let interLogData : Data
182
+ if Self . isFirstLog { interLogData = Data ( ) ; Self . isFirstLog = false }
183
+ else { interLogData = lineSeparator}
184
184
/* Is there a better idea than silently drop the message in case of fail? */
185
- _ = try ? outputFileDescriptor. writeAll ( prefix + dataNoSeparator )
185
+ _ = try ? outputFileDescriptor. writeAll ( interLogData + lineDataNoSeparator )
186
186
}
187
187
}
188
188
You can’t perform that action at this time.
0 commit comments