User log, how to make a carriage return in 'Log Event' ?

Christoph

Member
Hi, how to make a carriage return in 'Log Event' ?
Currently I am using some special characters to separate things, but it is then hard to read in the User Log. So I would prefer a line jump.
1680002014837.png

Concerning the User Log:
- is it possible to tag logs with the source macro ? that would ease the log analysis.
- is it possible to bold/underline text ? for example, like in Markdown.
 

Endercraft

Moderator (& bug finder :D)
Hi, how to make a carriage return in 'Log Event' ?
Currently I am using some special characters to separate things, but it is then hard to read in the User Log. So I would prefer a line jump.
Use \n.
- is it possible to tag logs with the source macro ? that would ease the log analysis.
Only way is to write the macro name in the entry then use the search function. Except it does not exist yet.
- is it possible to bold/underline text ? for example, like in Markdown.
It is possible in system log, not in User log however.
 

Christoph

Member
Thanks the name of macro works.

There is an issue with using carriage return though: the user log does not consider it as block! so it is displaying it in the wrong order 🙄

For example: If you enter in 'Log Event': Line1 \nLine2 \nLine3 \nLine4
we have this:
Line4 Line3 Line2 Line1
when the end user except this:
Line1 Line2 Line3 Line4
 

Christoph

Member
This icon is a different thing: it is changing the fact that the last log is at the top or at the bottom.
A log entry should be considered as block, here it is considered as several block. As a consequence when you use carriage return, it is only readable with the newest item displayed at the bottom mode.
 

MacroDroidDev

Administrator
Staff member
Apologies, and I have to say looking at the user log nowadays it's pretty much garbage. It's very limited and awkward due to the implementation and I don't intend to fix this issue in it's current state. (I would recommend that you just use the newest at the bottom order as it should all be in the correct order).

At some point this year I hope to have a massive overhaul of the user log feature and make it much, much better.
 

Christoph

Member
Creating logs is the best practice a developer can do to ease the maintenance of his program. So, I would really appreciate some improvement of it.

Do you currently use a different way to log than the User Log ? for production? and for tests?
 

Endercraft

Moderator (& bug finder :D)
Creating logs is the best practice a developer can do to ease the maintenance of his program. So, I would really appreciate some improvement of it.

Do you currently use a different way to log than the User Log ? for production? and for tests?
System log...
 

Endercraft

Moderator (& bug finder :D)
How do you write inside the System log ?
is it possible to make a carriage return in it ?
The system log logs a lot of things. Writing in it is not directly possible (I made a request for that).

 

Christoph

Member
Is it possible to prevent an action to add an entry in the System Log ?

There is so much useless details in the System Log that I can hardly make something of it.
For example, in macros, I have variables for configuring the macro (to avoid hard-coding the configuration of it). But this creates completely useless info in the log, here is what I then have in the System Log for each configuration variables :
1680082237702.png
 

MacroDroidDev

Administrator
Staff member
No it's not possible to disable logging for just a single action at this time, but it's something that is definitely worthy of consideration.
 

Andydroid

Member
Instead of the User Log, you coud just use the Write To File action to write to your own log file- this does write strings containing newlines in the expected order. If you put all the filename handling and Write To File actions in an Action Block then you have a single action alternative to the Log Event action...
 

Endercraft

Moderator (& bug finder :D)
Instead of the User Log, you coud just use the Write To File action to write to your own log file- this does write strings containing newlines in the expected order. If you put all the filename handling and Write To File actions in an Action Block then you have a single action alternative to the Log Event action...
I guess the user log is easier to access and manage. After all it is a file in MacroDroid's internal files ;)
 

Christoph

Member
That's a good idea, by writing in a file, I could have a log per macro instead of having all logs in a place where it is not possible to filter/search. It looks like a good option.
Do you have an example of Action Block for this ? (I have not yet used this MD feature)
 

Andydroid

Member
That's a good idea, by writing in a file, I could have a log per macro instead of having all logs in a place where it is not possible to filter/search. It looks like a good option.
Do you have an example of Action Block for this ? (I have not yet used this MD feature)

At its simplest you can create an Action Block something like this (if you only have one log file, you don't need the sLogFilename Input Variable):
Screenshot_20230329_122401.jpg

where the Write To File Action is something like this (you need to give Macrodroid Write permission to the folder):
Screenshot_20230329_122812.jpg

Then, when you want to log something, simply call the Action Block with the appropriate values (filename and string)...
 

Christoph

Member
@Andydroid thank for the Action Block. I have implemented your proposition it works great.

I really like the idea of having a .log file per macro to ease maintenance. Do you use and if someone know a good Android Logcat viewer where these files can be integrated, it would be great for quick & advanced MacroDroid log analysis.
 
Top