cache image, download log etc.

This commit is contained in:
Hellowlol 2016-05-09 00:44:02 +02:00
parent 21fcbd85d8
commit 9ae441b75a
7 changed files with 452 additions and 375 deletions

View file

@ -31,7 +31,7 @@ import helpers
# These settings are for file logging only
FILENAME = "plexpy.log"
MAX_SIZE = 1000000 # 1 MB
MAX_SIZE = 5000000 # 5 MB
MAX_FILES = 5
_BLACKLIST_WORDS = []
@ -42,18 +42,6 @@ logger = logging.getLogger("plexpy")
# Global queue for multiprocessing logging
queue = None
class LogListHandler(logging.Handler):
"""
Log handler for Web UI.
"""
def emit(self, record):
message = self.format(record)
message = message.replace("\n", "<br />")
plexpy.LOG_LIST.insert(0, (helpers.now(), message, record.levelname, record.threadName))
class NoThreadFilter(logging.Filter):
"""
Log filter for the current thread
@ -209,12 +197,6 @@ def initLogger(console=False, log_dir=False, verbose=False):
logger.propagate = False
logger.setLevel(logging.DEBUG if verbose else logging.INFO)
# Add list logger
loglist_handler = LogListHandler()
loglist_handler.setLevel(logging.DEBUG)
logger.addHandler(loglist_handler)
# Setup file logger
if log_dir:
filename = os.path.join(log_dir, FILENAME)