Coder Social home page Coder Social logo

Non-blocking logger about picologging HOT 5 CLOSED

microsoft avatar microsoft commented on May 13, 2024
Non-blocking logger

from picologging.

Comments (5)

tonybaloney avatar tonybaloney commented on May 13, 2024 1

Great question, I'm still working on the basics for this library, but one of the first production use cases is an async worker and the reason I started this project is because the standard library logging module causes such an overhead.

I'll have a think about this next and update the thread

from picologging.

tonybaloney avatar tonybaloney commented on May 13, 2024 1

Looking at the stdlib implementation, it was added in Python 3.2. I'd probably do it differently today. It's using pickling/copy.copy for thread safety and a worker thread, but a single one.

Firstly adding an async Handler and Logger specification, with a coroutine for .info(), .warning() etc. and then using an internal asyncio queue to write records and then sending those to the handlers in a worker thread, or within the coroutine. There are async stream writers for the outputs of the handler, so it would implement coroutines from top to bottom.

This library only supports Python 3.7+ anyway.

Not sure on the performance gains/losses compared to the queue, listener and worker thread approach.

What do you think?

from picologging.

tonybaloney avatar tonybaloney commented on May 13, 2024 1

Try 0.6.0, it comes with a queue handler and listener. I'm working on the async stuff later

from picologging.

Goldziher avatar Goldziher commented on May 13, 2024

Great. I'd gladly contribute as well when there is more clarity

from picologging.

Goldziher avatar Goldziher commented on May 13, 2024

Sounds good. I also don't know about the performance differences, but I would assume that an async approach would scale better .

from picologging.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.