Don't print stack and exc traces
This commit is contained in:
parent
5f56f59ab8
commit
4e3a16b8d4
@ -481,7 +481,7 @@ class BaseCitizen(access_points.CitizenAPI):
|
||||
if is_warning:
|
||||
self.logger.warning(msg, extra=extra)
|
||||
else:
|
||||
self.logger.error(msg, exc_info=True, stack_info=True, extra=extra)
|
||||
self.logger.error(msg, extra=extra)
|
||||
|
||||
def sleep(self, seconds: Union[int, float, Decimal]):
|
||||
if seconds < 0:
|
||||
@ -2292,7 +2292,7 @@ class CitizenMilitary(CitizenTravel):
|
||||
self.report_error(f"Unable to get deployment inventory because: {ret.get('message')}")
|
||||
return ret
|
||||
|
||||
def deploy(self, division: classes.BattleDivision, side: classes.BattleSide, energy: int, _retry = 0):
|
||||
def deploy(self, division: classes.BattleDivision, side: classes.BattleSide, energy: int, _retry=0):
|
||||
_energy = int(energy)
|
||||
deploy_inv = self.get_deploy_inventory(division, side)
|
||||
if not deploy_inv['minEnergy'] <= energy <= deploy_inv['maxEnergy']:
|
||||
@ -2314,6 +2314,9 @@ class CitizenMilitary(CitizenTravel):
|
||||
used_energy = amount * recovers
|
||||
recoverable -= used_energy
|
||||
_energy -= used_energy
|
||||
if _energy <= 0:
|
||||
break
|
||||
if _energy > 0:
|
||||
energy -= _energy
|
||||
weapon_q = -1
|
||||
weapon_strength = 0
|
||||
|
@ -52,6 +52,18 @@ class ErepublikFormatter(logging.Formatter):
|
||||
return datetime.datetime.utcfromtimestamp(timestamp).astimezone(erep_tz)
|
||||
|
||||
def format(self, record: logging.LogRecord) -> str:
|
||||
"""
|
||||
Format the specified record as text.
|
||||
|
||||
The record's attribute dictionary is used as the operand to a
|
||||
string formatting operation which yields the returned string.
|
||||
Before formatting the dictionary, a couple of preparatory steps
|
||||
are carried out. The message attribute of the record is computed
|
||||
using LogRecord.getMessage(). If the formatting string uses the
|
||||
time (as determined by a call to usesTime(), formatTime() is
|
||||
called to format the event time. If there is exception information,
|
||||
it is formatted using formatException() and appended to the message.
|
||||
"""
|
||||
if record.levelno == logging.DEBUG:
|
||||
self._fmt = self.dbg_fmt
|
||||
elif record.levelno == logging.INFO:
|
||||
@ -59,7 +71,17 @@ class ErepublikFormatter(logging.Formatter):
|
||||
else:
|
||||
self._fmt = self.default_fmt
|
||||
self._style = logging.PercentStyle(self._fmt)
|
||||
return super().format(record)
|
||||
|
||||
record.message = record.getMessage()
|
||||
if self.usesTime():
|
||||
record.asctime = self.formatTime(record, self.datefmt)
|
||||
s = self.formatMessage(record)
|
||||
if record.exc_info:
|
||||
# Cache the traceback text to avoid converting it multiple times
|
||||
# (it's constant anyway)
|
||||
if not record.exc_text:
|
||||
record.exc_text = self.formatException(record.exc_info)
|
||||
return s
|
||||
|
||||
def formatTime(self, record, datefmt=None):
|
||||
dt = self.converter(record.created)
|
||||
@ -69,6 +91,9 @@ class ErepublikFormatter(logging.Formatter):
|
||||
s = dt.strftime('%Y-%m-%d %H:%M:%S')
|
||||
return s
|
||||
|
||||
def usesTime(self):
|
||||
return self._style.usesTime()
|
||||
|
||||
|
||||
class ErepublikErrorHTTTPHandler(handlers.HTTPHandler):
|
||||
def __init__(self, reporter: Reporter):
|
||||
|
Loading…
x
Reference in New Issue
Block a user