kazu-yamamoto / logger

A fast logging system for Haskell
159 stars 68 forks source link

`rmLoggerSet` does not flush when `SingleLogger` is in use #208

Closed nh2 closed 1 year ago

nh2 commented 1 year ago

https://github.com/kazu-yamamoto/logger/blob/e04ea1787b887c5b96d9ad0f718115854d0d7efe/fast-logger/System/Log/FastLogger/LoggerSet.hs#L161-L171

The docs say "Flushing the buffers".

For MultiLogger that happens here:

https://github.com/kazu-yamamoto/logger/blob/e04ea1787b887c5b96d9ad0f718115854d0d7efe/fast-logger/System/Log/FastLogger/MultiLogger.hs#L107-L110

But for SingleLogger the call to flushAllLog is missing:

https://github.com/kazu-yamamoto/logger/blob/e04ea1787b887c5b96d9ad0f718115854d0d7efe/fast-logger/System/Log/FastLogger/SingleLogger.hs#L102-L105

Should there be a

System.Log.FastLogger.SingleLogger.flushAllLog sl 

in here?


I found this while reading the code after some log lines are seemingly missing in my log files, for an application that uses newFileLoggerSetN defaultBufSize (Just 1) fp, which should lead to the SingleLogger code path.

nh2 commented 1 year ago

I found this while reading the code after some log lines are seemingly missing in my log files, for an application that uses newFileLoggerSetN defaultBufSize (Just 1) fp, which should lead to the SingleLogger code path.

That said, the application on which I observed this uses fast-logger-3.0.5, which does not have the SingleLogger module at all yet.

kazu-yamamoto commented 1 year ago

You are right. Could you send a PR to record your credit?

nh2 commented 1 year ago

PR at #209

nh2 commented 1 year ago

Closing due to https://github.com/kazu-yamamoto/logger/pull/209#issuecomment-1574817806