What's the logging strategy?

I run restic automatically on a regular basis to do backups. My restic logs are saved but they look like this:

duration: 1:06:26, 15.66MiB/s
snapshot 836d3ff8 saved
using parent snapshot 836d3ff8
scan [/foo]
[0:00] 2748 directories, 6071 files, 61.010 GiB
scanned 2748 directories, 6071 files in 0:00
[0:27] 100.00%  0B/s  61.010 GiB / 61.010 GiB  8819 / 8819 items  0 errors  ETA 0:00 

duration: 0:27, 2308.34MiB/s
snapshot a5b1fa0f saved
scan [/foo]
[0:00] 2758 directories, 6107 files, 61.032 GiB
scanned 2758 directories, 6107 files in 0:00
[3:25] 100.00%  0B/s  61.032 GiB / 61.032 GiB  8865 / 8865 items  0 errors  ETA 0:00 

duration: 3:25, 303.47MiB/s
snapshot a4372e40 saved
scan [/foo]
[0:00] 2770 directories, 6124 files, 29.553 GiB
scanned 2770 directories, 6124 files in 0:00
[1:29] 100.00%  0B/s  29.553 GiB / 29.553 GiB  8894 / 8894 items  0 errors  ETA 0:00 

duration: 1:29, 339.81MiB/s
snapshot 27ed19fc saved

There are no dates/times, and it’s hard to tell where one backup finished and another started because the extra line break is not actually where that happens… Is there a special flag I need to use, or is this something that can be improved? I’d personally like to see some sort of regular output every so often (with a timestamp!) indicating progress, so I can better follow a backup in progress, etc.

You can add date to the output (before the restic command), as well as a couple of extra lines or similar, if you wish. I presume you’re collecting these logs from the restic output, and in that case it’s pretty much what it is. You probably don’t want restic to include newlines and stuff in the regular output, better to append that yourself.

Okay. I guess that’s better than nothing. It just means I have to write a script around the command instead of running the command directly.

Nah, but the command of course becomes a little more complex.

Here’s an example that adds two newlines and the date before the restic output:

(echo; echo; date; restic ...) >> log.txt

You can run that on the command line, no need for a script.

Sounds good, although I’m using macOS’s LaunchAgents which, AFAIK, don’t parse bash like that – you simply give it a command and it runs it. So I’ll have to write a script.

Perhaps instead of starting restic directly you can start bash which starts restic, but also runs the set of commands I suggested?

The top-level answer to your question about the logging strategy is: There isn’t one (yet). At the moment, the output is tailored towards interactive shell usage, and that’s it. We’ll probably add more output modes as the program matures.