Skip to content

Commit

Permalink
hot-reload for code: dont log watch messages
Browse files Browse the repository at this point in the history
  • Loading branch information
milahu committed Jun 15, 2024
1 parent 8e2cc83 commit 43e4d49
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/pyload/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from .utils import format, fs
from .utils.misc import reversemap
from .threads.watchdog_thread import WatchdogThread
from ..plugins.helpers import str_exc


class Restart(Exception):
Expand Down Expand Up @@ -290,14 +291,19 @@ def _init_managers(self):

def _init_hotreload_code(self):
# start hot-reload for code
def jurigged_logger(arg):
# dont log "watch ..." messages. too verbose
if isinstance(arg, jurigged.live.WatchOperation):
return
self.log.info(f"jurigged: {str_exc(arg)}")
def jurigged_watch(path):
jurigged.watch(path, jurigged_logger)
self.log.info(f"Starting hot-reload from userdir {self.userdir}")
# FIXME disable "watch ..." messages
jurigged.watch(self.userdir)
jurigged_watch(self.userdir)
self.sourcedir = os.path.dirname(os.path.dirname(__file__))
if os.access(__file__, os.W_OK):
self.log.info(f"Starting hot-reload from sourcedir {self.sourcedir}")
# FIXME disable "watch ..." messages
jurigged.watch(self.sourcedir)
jurigged_watch(self.sourcedir)

def _init_hotreload_plugins(self):
# start hot-reload for plugins
Expand Down

0 comments on commit 43e4d49

Please sign in to comment.