diff --git a/lib/pyrrent2http/engine.py b/lib/pyrrent2http/engine.py index a0c109d..5e104ad 100644 --- a/lib/pyrrent2http/engine.py +++ b/lib/pyrrent2http/engine.py @@ -21,6 +21,7 @@ from . import SessionStatus, FileStatus, PeerInfo, MediaType, Encryption from util import can_bind, find_free_port, ensure_fs_encoding import threading +LOGGING = True class Engine: """ @@ -202,6 +203,7 @@ class Engine: self.logpipe = None # self.process = None self.started = False + self.pyrrent2http_loop = None @staticmethod def _validate_save_path(path): @@ -302,9 +304,11 @@ class Engine: def __init__(self, _log): self._log = _log def info(self, message): - self._log('INFO: %s' % (message,)) + if LOGGING: + self._log('INFO: %s' % (message,)) def error(self, message): - self._log('ERROR: %s' % (message,)) + if LOGGING: + self._log('ERROR: %s' % (message,)) pyrrent2http.logging = Logging(self._log) # startupinfo = None # if self.platform.system == "windows": @@ -485,7 +489,8 @@ class Engine: """ # if self.logpipe and self.wait_on_close_timeout is None: # self.logpipe.close() - if self.is_alive(): +### if self.is_alive(): + if True: self._log("Shutting down pyrrent2http...") # self._request('shutdown') self.pyrrent2http.shutdown() diff --git a/lib/pyrrent2http/pyrrent2http.py b/lib/pyrrent2http/pyrrent2http.py index 5fd586c..01fd0d9 100644 --- a/lib/pyrrent2http/pyrrent2http.py +++ b/lib/pyrrent2http/pyrrent2http.py @@ -28,7 +28,7 @@ import io import socket -logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG) + ###################################################################################### @@ -1063,6 +1063,7 @@ class Pyrrent2http(object): if __name__ == '__main__': try: import logging + logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG) pyrrent2http = Pyrrent2http() pyrrent2http.parseFlags()