Closed nicholi closed 5 years ago
If we're adding append it should also be done for gzip'ed logs.
Instead of a separate function, pass append as a parameter to both log_open_file and log_open_gz_file.
Not the greatest C++ dev, but I'm guessing that should just mean passing 'a' to gzopen? The concept of appending to a gzip seems a little weird, but if it works.
I'll re-work the PR to take that into account, both as a parameter. And change up my PR related to this on rtorrent as well.
@Nicholi , what do you think about @pyroscope's solution instead? It seems way easier, not requireing any new command. I'm not sure about gz type though.
@chros73 That has already been merged, this is a different issue as people might want to keep the previous log file content.
Also yes, just add a bool parameter and "a" to gzopen should work.
@rakshasa , Oh, I see, I can't keep track anymore what's happened :)
Switched to simple append parameter, with default value of false. Should prevent any API breakage as well.
Rather than current implentation of truncate/overwrite by default.
The only real difference from standard open_file is in the ofstream constructor. Added tests as well.
Makes using simple file names great again, and prevent rtorrent from overwriting all files on a restart. I also ran into a small issue when using logrotate.d and the copytruncate directive. After a log rotation had been performed, and when rtorrent began writing to file again, it wouuld be filled with null 0's up to the last position it had been written to. This would potentially solve that.