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:
|
if is_warning:
|
||||||
self.logger.warning(msg, extra=extra)
|
self.logger.warning(msg, extra=extra)
|
||||||
else:
|
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]):
|
def sleep(self, seconds: Union[int, float, Decimal]):
|
||||||
if seconds < 0:
|
if seconds < 0:
|
||||||
@ -2314,6 +2314,9 @@ class CitizenMilitary(CitizenTravel):
|
|||||||
used_energy = amount * recovers
|
used_energy = amount * recovers
|
||||||
recoverable -= used_energy
|
recoverable -= used_energy
|
||||||
_energy -= used_energy
|
_energy -= used_energy
|
||||||
|
if _energy <= 0:
|
||||||
|
break
|
||||||
|
if _energy > 0:
|
||||||
energy -= _energy
|
energy -= _energy
|
||||||
weapon_q = -1
|
weapon_q = -1
|
||||||
weapon_strength = 0
|
weapon_strength = 0
|
||||||
|
@ -52,6 +52,18 @@ class ErepublikFormatter(logging.Formatter):
|
|||||||
return datetime.datetime.utcfromtimestamp(timestamp).astimezone(erep_tz)
|
return datetime.datetime.utcfromtimestamp(timestamp).astimezone(erep_tz)
|
||||||
|
|
||||||
def format(self, record: logging.LogRecord) -> str:
|
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:
|
if record.levelno == logging.DEBUG:
|
||||||
self._fmt = self.dbg_fmt
|
self._fmt = self.dbg_fmt
|
||||||
elif record.levelno == logging.INFO:
|
elif record.levelno == logging.INFO:
|
||||||
@ -59,7 +71,17 @@ class ErepublikFormatter(logging.Formatter):
|
|||||||
else:
|
else:
|
||||||
self._fmt = self.default_fmt
|
self._fmt = self.default_fmt
|
||||||
self._style = logging.PercentStyle(self._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):
|
def formatTime(self, record, datefmt=None):
|
||||||
dt = self.converter(record.created)
|
dt = self.converter(record.created)
|
||||||
@ -69,6 +91,9 @@ class ErepublikFormatter(logging.Formatter):
|
|||||||
s = dt.strftime('%Y-%m-%d %H:%M:%S')
|
s = dt.strftime('%Y-%m-%d %H:%M:%S')
|
||||||
return s
|
return s
|
||||||
|
|
||||||
|
def usesTime(self):
|
||||||
|
return self._style.usesTime()
|
||||||
|
|
||||||
|
|
||||||
class ErepublikErrorHTTTPHandler(handlers.HTTPHandler):
|
class ErepublikErrorHTTTPHandler(handlers.HTTPHandler):
|
||||||
def __init__(self, reporter: Reporter):
|
def __init__(self, reporter: Reporter):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user