invenia / Memento.jl

A flexible logging library for Julia
https://invenia.github.io/Memento.jl/latest
Other
87 stars 14 forks source link

emit does not seek the end of the file before flush #179

Open tseste opened 3 years ago

tseste commented 3 years ago

Hey there,

I've been using your package lately and I noticed that before the logger flushes a message, it is not seeking for the end of the file.

For me it was an issue because I use one more stream to write to the same file, and that other stream actually handles the seek before writing.

It is really a very small change and it might help others to.

The addition is to use seekend(handler.io) in the beginning of emit function here https://github.com/invenia/Memento.jl/blob/aea16b63a5f9801c54cb9b67d02ab3f767d8cb46/src/handlers.jl#L206 Let's say line 207

tseste commented 3 years ago

Actually, more like

if typeof(handler.io) <: IOStream
    seekend(handler.io)
end