So I have a working implementation of session log. Turned out a bit trickier than I was expecting, because we need to care about preserving the previous session log till verified that we have the lock (a.k.a. the lockfile).
So essentially I had to tie session log writing to having acquired the lock file. Which means that for commands which do not need the lock file, no session log is recorded. Also no log is recorded at the early stages of commands initialization, before the lock is acquired.
Specifically with the current implementation, these commands trigger writing session log:
start, boot, stop, pause, resume
These commands do not:
status, gen_config, gen_stats, help, enable, disable, enabled
Commands restart, reload are handled as a composite of stop and start, and the lock is first acquired when the stop command is executed, so this is where the session log starts to get written.
I went a bit further and implemented a second separate log, exclusive to the update command. So with the current implementation, there will be abl_session.log and abl_update.log. This in order to avoid the update log from overwriting the session log and vice versa.
The report_failure() function is now called with the current session log attached to the message (passed via the 1st argument).
Also the luci_log variable is set when current log is available (either session log or update log). @Ree9
I don't want to torture @Lynx too much, so for now this is on my Github:
https://github.com/friendly-bits/adblock-lean/tree/Implement_session_log
Testing and comments are welcome, of course. BTW should the session log register date and time?
And @Lynx let me know when you are ready to accept more PR's - no rush 
Edit: forgot to mention, the print_log command is also implemented, which prints the most recent session log (not the update log).
Edit2: bruh, I created the branch on Github but forgot to push the commit. Now fixed.