On Mon, Sep 13, 2021 at 11:56:52PM -0400, Sehrope Sarkuni wrote: > Good catch. Staring at that piece again, that's tricky as it tries to > aggressively free the buffer before calling write_cvslog(...). Which can't > just be duplicated for additional destinations. > > I think we need to pull up the negative case (i.e. syslogger not available) > before the other destinations and if it matches, free and exit early. > Otherwise, free the buffer and call whatever destination routines are > enabled.
Yes, I got a similar impression. > I started on a bit of this as well. There's so much overlap already between > the syslog_ and csvlog code that I'm going to put that together first. Then > the json addition should just fall into a couple of call sites. > > I'm thinking of adding an internal struct to house the FILE* and file > names. Then all the opening, closing, and log rotation code can pass > pointers to those and centralize the pfree() and NULL checks. Agreed on both points (using a structure and doing the refactoring as a first patch). -- Michael
signature.asc
Description: PGP signature