Instead of using the log section of the rule I could easily have put it as log
in the params section. The only difference is the additional params.
of {params.log}
. In fact, by putting it in params I have more control as I do not need the log to have all the wildcards. For example, I could have multiple processes appending to the same log with >>
.
Why is the log section useful, besides possibly making the code look cleaner?
From the docs:
Log files can be used as input for other rules, just like any other output file. However, unlike output files, log files are not deleted upon error. This is obviously necessary in order to discover causes of errors which might become visible in the log file.
If you use params
for logging, then you cannot use log file as input for other rules. Having said that, I never got into the habit of using the log directive myself.