kazu-yamamoto / logger

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

newFastLogger1 ensures the ordering of logs #207

Closed kazu-yamamoto closed 1 year ago

kazu-yamamoto commented 1 year ago

@carbolymer @khibino This should fix #203.

The old logic cannot ensure the ordering of logs even if the number of internal builders are 1. This PR calls the old one MultiLogger and introduces a new one called SingleLogger. SingleLogger uses a queue of builder in addition to an internal builder. The internal builder gets empty and the queue glows atomically. The builders of the queue are written by a single dedicated thread, thus the ordering is maintained. A test case is also provided.

kazu-yamamoto commented 1 year ago

@carbolymer @khibino Now SingleLogger does not use MVar to protect Buffer since he is a single user of the Buffer. Please check it out again.

kazu-yamamoto commented 1 year ago

Merged. I will release a new major version!

kazu-yamamoto commented 1 year ago

Released!