Missing newlines in logfile

Project: 
Gurux.DLMS.Python

The logfile is written without newlines between the records, proposed patch:

diff --git a/Gurux.DLMS.Client.Example.python/GXDLMSReader.py b/Gurux.DLMS.Client.Example.python/GXDLMSReader.py
index a339d47..30d9562 100644
--- a/Gurux.DLMS.Client.Example.python/GXDLMSReader.py
+++ b/Gurux.DLMS.Client.Example.python/GXDLMSReader.py
@@ -110,7 +110,7 @@ class GXDLMSReader:
def writeTrace(self, line, level):
if self.trace >= level:
print(line)
- self.logFile.write(line)
+ self.logFile.write(line + "\n")

def readDLMSPacket(self, data, reply=None):
if not reply:

Status: 
Closed (fixed)
Priority: 
Normal
Category: 
Bug report
Component: 
Code
Reporter: 
bsdphk
Created: 
Fri, 08/07/2020 - 10:57
Updated: 
Fri, 08/07/2020 - 11:54

Comments

Administrator's picture

Hi,

This is fixed.

Administrator's picture

Status: Active » Closed (fixed)

Thanks, that was quick :-)

One other thing: You may want to consider calling .flush() after each write, otherwise the logfile doesn't show anything until the program either terminates or has filled th 4k/16k/whatever size write bufer.

One other thing: You may want to consider calling .flush() after each write, otherwise the logfile doesn't show anything until the program either terminates or has filled th 4k/16k/whatever size write bufer.