Coder Social home page Coder Social logo

How to turn off logging? about pyinotify HOT 6 CLOSED

seb-m avatar seb-m commented on August 17, 2024
How to turn off logging?

from pyinotify.

Comments (6)

seb-m avatar seb-m commented on August 17, 2024

Take a look at pyinotify.log()and to the class PrintAllEvents.

from pyinotify.

fariazz avatar fariazz commented on August 17, 2024

not sure how to switch it off. Where do I have to define this class? My code is:

wm = pyinotify.WatchManager()
notifier = pyinotify.Notifier(wm)
wm.add_watch(self.price_file, pyinotify.IN_CLOSE_WRITE)
notifier.loop(callback=self.handler)

self.handler is just a dummy method that prints "file changed"

from pyinotify.

seb-m avatar seb-m commented on August 17, 2024

callbackis not intended for this use, you should inspire yourself from this trivial example tutorial_notifier.py with in particular the class EventHandler.

from pyinotify.

fariazz avatar fariazz commented on August 17, 2024

thanks, callback here is working fine as I need it. I tried doing it as the tutorial before but in that case I need to create an EventHandler class, whereas what I needed was just to call a method that belongs to the current class object where all the code is located.

anyway that is working well as I implemented it. Just got stuck with the logging, but it's ok if there is no simple way to turn it off.

the code has been of great help to my project to thanks a lot for building it!

from pyinotify.

seb-m avatar seb-m commented on August 17, 2024

Ok, do as you want but these events are printed because it is a default behavior resulting from the unusual fact there are no handler (such as EventHandler) defined in you code. Thus a 'by default' behavior of pyinotify makes it handle events by calling an instance of PrintAllEvents to print them. That's why I suggested you find a way to implement an event handler, even an empty one without any methods, just to override this default behavior.

from pyinotify.

fariazz avatar fariazz commented on August 17, 2024

got it! thanks I will implement an empty handler then.

from pyinotify.

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.