log4mongo / log4mongo-python

python logging handler for mongo database
http://log4mongo.org
Other
111 stars 37 forks source link

BufferedMongoHandler - New handler with buffered writes #22

Closed ronhanson closed 7 years ago

ronhanson commented 7 years ago

Hi! As discussed by email, I managed to pull some time to write the buffered mongo handler we were talking about (=>https://github.com/log4mongo/log4mongo-python/issues/21) Here is a first version that is working for me since yesterday. It is not yet heavily tested but it stays simple so there should not be many problems. The only complexity resides in the thread usage for the periodical (timer) flush of the buffer. usage of such timer is fully optional. Available to discuss this further with you if needed. Many thanks in advance. Cheers! Ronan

oz123 commented 7 years ago

@ronhanson can you add some tests for this handler? This will document the use case also.

ronhanson commented 7 years ago

A set of tests have been added for the new BufferedMongoHandler. Buffer mechanism tested. Along with early flush (on critical) and also periodical flush. Tell me if you need some more. Cheers! Ronan

oz123 commented 7 years ago

@ronhanson thanks for the PR. I merged it on CLI. The code is there, and will be soon in PyPI.