From be9eaa08596c53e10b0cc600def427b2df22f432 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Mon, 13 Feb 2017 13:25:42 -0800 Subject: [PATCH] Fix timer, make logging less annoying when at Info or higher level. Only show command bonus logspam if there is any. --- eos/gamedata.py | 2 +- eos/saveddata/fit.py | 15 ++++++--------- eos/saveddata/module.py | 2 -- service/fit.py | 2 +- service/market.py | 3 +++ 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/eos/gamedata.py b/eos/gamedata.py index 97df52292..2d3ddd523 100644 --- a/eos/gamedata.py +++ b/eos/gamedata.py @@ -193,7 +193,7 @@ class Effect(EqBase): self.__activeByDefault = True self.__type = None pyfalog.debug("ImportError or AttributeError generating handler:") - pyfalog.warning(e) + pyfalog.debug(e) except Exception as e: pyfalog.critical("Exception generating handler:") pyfalog.critical(e) diff --git a/eos/saveddata/fit.py b/eos/saveddata/fit.py index b275aef5a..4e0a6071b 100644 --- a/eos/saveddata/fit.py +++ b/eos/saveddata/fit.py @@ -630,9 +630,7 @@ class Fit(object): del self.commandBonuses[warfareBuffID] def calculateModifiedAttributes(self, targetFit=None, withBoosters=False, dirtyStorage=None): - # TODO: Validate that remooving this doesn't break anything - # TODO: Keywords: logbook logging Ebag - # timer = Timer(u'Fit: {}, {}'.format(self.ID, self.name), logger) + timer = Timer(u'Fit: {}, {}'.format(self.ID, self.name), pyfalog) pyfalog.debug("Starting fit calculation on: {0}, withBoosters: {1}", self, withBoosters) shadow = False @@ -732,14 +730,14 @@ class Fit(object): # targetFit.register(item, origin=self) item.calculateModifiedAttributes(targetFit, runTime, False, True) - print "Command: " - print self.commandBonuses + if len(self.commandBonuses) > 0: + pyfalog.info("Command bonuses applied.") + pyfalog.debug(self.commandBonuses) if not withBoosters and self.commandBonuses: self.__runCommandBoosts(runTime) - # TODO: Tied with timer above - # timer.checkpoint('Done with runtime: %s' % runTime) + timer.checkpoint('Done with runtime: %s' % runTime) # Mark fit as calculated self.__calculated = True @@ -750,8 +748,7 @@ class Fit(object): if fit.getProjectionInfo(self.ID).active: fit.calculateModifiedAttributes(self, withBoosters=withBoosters, dirtyStorage=dirtyStorage) - # TODO: Tied with timer above - # timer.checkpoint('Done with fit calculation') + timer.checkpoint('Done with fit calculation') if shadow: pyfalog.debug("Delete shadow fit object") diff --git a/eos/saveddata/module.py b/eos/saveddata/module.py index 17b6a8c04..55d8c7ed1 100644 --- a/eos/saveddata/module.py +++ b/eos/saveddata/module.py @@ -639,7 +639,6 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): effect.handler(fit, self, chargeContext, effect=effect) except: effect.handler(fit, self, chargeContext) - pyfalog.debug("Applying effect handler for charge without effect.") if self.item: if self.state >= State.OVERHEATED: @@ -663,7 +662,6 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): effect.handler(fit, self, context, effect=effect) except: effect.handler(fit, self, context) - pyfalog.debug("Applying effect handler without effect") @property def cycleTime(self): diff --git a/service/fit.py b/service/fit.py index c0bbfad62..6834fc395 100644 --- a/service/fit.py +++ b/service/fit.py @@ -1011,7 +1011,7 @@ class Fit(object): self.recalc(fit) def recalc(self, fit, withBoosters=True): - pyfalog.debug("=" * 10 + "recalc" + "=" * 10) + pyfalog.info("=" * 10 + "recalc" + "=" * 10) if fit.factorReload is not self.serviceFittingOptions["useGlobalForceReload"]: fit.factorReload = self.serviceFittingOptions["useGlobalForceReload"] fit.clear() diff --git a/service/market.py b/service/market.py index cd2ea19cf..80b86bb44 100644 --- a/service/market.py +++ b/service/market.py @@ -50,6 +50,7 @@ mktRdy = threading.Event() class ShipBrowserWorkerThread(threading.Thread): def __init__(self): threading.Thread.__init__(self) + pyfalog.debug("Initialize ShipBrowserWorkerThread.") self.name = "ShipBrowser" def run(self): @@ -88,6 +89,7 @@ class PriceWorkerThread(threading.Thread): def __init__(self): threading.Thread.__init__(self) self.name = "PriceWorker" + pyfalog.debug("Initialize PriceWorkerThread.") def run(self): pyfalog.debug("Run start") @@ -129,6 +131,7 @@ class SearchWorkerThread(threading.Thread): def __init__(self): threading.Thread.__init__(self) self.name = "SearchWorker" + pyfalog.debug("Initialize SearchWorkerThread.") def run(self): self.cv = threading.Condition()