kazu-yamamoto/logger

SingleLogger misses and repeats log messages

Closed this issue · 3 comments

import System.Log.FastLogger
import Control.Monad

main = do
    (put, close) <- newFastLogger1 $ LogStdout 2
    forM_ [1..10] $ \ i -> put $ toLogStr $ show i <> "\n"
    close

outputs

2
3
4
5
6
7
8
9
9
10

I suspect the issue is in

| slgrBufSize < olen + nlen = ((nlogmsg, nlogmsg:q), True)

it drops ologmsg and repeats nlogmsg.

@vshabanov You are right. Would you send a PR?

I think nlogmsg:q should be ologmsg:q.

Added a PR. Tested it, and it seems to fix the issue.