I created an XPROC 3.0 pipeline that performs several tasks to reorganize files using element such as p:for-each, p:choose, file steps and validation steps. I would like to log the main events such as error, the files processed, etc.
The first solution I tried is :
Then I tried to concatenate the different messages at the different levels with
But I find this second way not very elegant.
Can you advise me on the best practice to construct a log file ?
Thank you !
In XProc 1.0 there was no explicit support for logging, which is a weakness of that version of the language. You can open and close a log file yourself, and rewrite it, as you describe in your question, but as you point out, there are issues with that approach. Many if not all XProc 1.0 processors support some kind of message
extension step which will write a line of text to the end of a log file.
But since you're using XProc 3.0 you can make use of support for logging that's part of the core XProc language, in the form of a message
attribute on any XProc step:
https://spec.xproc.org/master/head/xproc/#messages