houseabsolute / Log-Dispatch

Dispatches messages to one or more outputs
https://metacpan.org/release/Log-Dispatch/
Other
12 stars 29 forks source link

Log::Dispatch::File doesn't respect "mode" values that contain I/O layers for example ">>:encoding(utf8)" #69

Closed cmanley closed 1 year ago

cmanley commented 1 year ago

See title. The problem is in sub new where it validates the mode. The validation doesn't take IO layers into account and defaults to '>>'. It'll also default to '>>' if close_after_write is true. Also side note: beware of using binmode with some IO layers such as gzip: that'll mess the output up.

autarch commented 1 year ago

Thanks for the report, but this works as documented. The allowed values for mode are write, >, append, or >>. There's a separate binmode param you can pass to the constructor which lets you set IO layers.

cmanley commented 1 year ago

Thanks. I wasn't aware of the layer option to binmode().