How to write log/txt file

You have a question or need an advice about how to do something? Ask it here!
Post Reply
rvtienhoven
Posts: 40
Joined: 06 Apr 2013 17:15
How to write log/txt file

Post by rvtienhoven »

Hi Bernd,

I want to create my 'custom' logfile. So, I want to write an rule to an .txt file with an command, so I can choose my own text.
Example:
27-7-2016 21:01:22 - Silence detection has detected an silence of 30 seconds.
27-7-2016 21:05:42 - Silence detection has detected noise again.
27-7-2016 21:06:24 - User Pietje has logged in
27-7-2016 21:50:24 - User Pietje has logged out.

I know that I can write text to an .txt file with the EXEC_WRITE_FILE command. But If I use it, it only stores the line and remove the earlier line. I want to store the new line in the .txt file, but not deleting the other content in the file. How could I do this?


Remi
User avatar
radio42
Site Admin
Posts: 9139
Joined: 05 Apr 2012 16:26
Location: Hamburg, Germany
Contact:
Re: How to write log/txt file

Post by radio42 »

So you can use any event in the system and then use the control-command "EXEC_WRITE_FILE".
E.g.:

Code: Select all

EXEC_WRITE_FILE C:\log\myFile.txt|au|${now} - Silence detection has detected an silence of 30 seconds.
Note: All commands as well as macros are fully listed in the User Manual Appendix.
rvtienhoven
Posts: 40
Joined: 06 Apr 2013 17:15
Re: How to write log/txt file

Post by rvtienhoven »

Yes. But then, all text is saved to each other instead of one text for each line. I want that every single text has his own line, so the file is normal readable.
By the standard playlist logging, every track has its own line. That is what i want...
User avatar
radio42
Site Admin
Posts: 9139
Joined: 05 Apr 2012 16:26
Location: Hamburg, Germany
Contact:
Re: How to write log/txt file

Post by radio42 »

OKay, that was a too simple example, just add the carried return line feed macro to the end of you command, like this:

Code: Select all

EXEC_WRITE_FILE C:\log\myFile.txt|au|${now} - Silence detection has detected an silence of 30 seconds.${CRLF}
or like this

Code: Select all

EXEC_WRITE_FILE C:\log\myFile.txt|au|${now} - Silence detection has detected an silence of 30 seconds.\r\n

Post Reply