dmLogInfo shows duplicate when \r\n

I’m using defold 1.2.147-2019-02-20, when I log using dmLogInfo,where the message has \r\n, it will show me that has two dmLogInfo. For example, dmLogInfo(“my log\r\n”); shows the following:
image
The number 2 shows that it has two dmLogInfo with the same message, but I only invoke dmLogInfo one time.

dmLogInfo() and other log calls automatically add a newline. You shouldn’t do that yourself. The(2) comes from the \r and \n generating a newline each.

1 Like

Message: my log\r\n just to demonstrate how this happen, in practice, message is come from network data

As @britzl mentions, dmLogInfo is a convenience function, which outputs a new line, because that’s the use case we have.

Note that the “2” only appears in the editor, in the stdout from the app, those characters are “displayed” properly, with extra newline.

You can either strip your whitespace yourself before printing, or implement your own log function.

1 Like