# to use, copy, modify, and distribute this software is granted under
# terms provided in the LICENSE file distributed with this software.
# to use, copy, modify, and distribute this software is granted under
# terms provided in the LICENSE file distributed with this software.
except BrokenPipeError:
if self.account and self.account.get("name"):
account = self.account.get("name")
else:
account = "an unknown user"
except BrokenPipeError:
if self.account and self.account.get("name"):
account = self.account.get("name")
else:
account = "an unknown user"
syslog_name = universe.categories["internal"]["logging"].get("syslog")
timestamp = time.asctime()[4:19]
syslog_name = universe.categories["internal"]["logging"].get("syslog")
timestamp = time.asctime()[4:19]
- # turn the message into a list of lines
- lines = filter(
- lambda x: x != "", [(x.rstrip()) for x in message.split("\n")]
- )
+ # turn the message into a list of nonempty lines
+ lines = [x for x in [(x.rstrip()) for x in message.split("\n")] if x != ""]
- facets.sort()
- for facet in facets:
- message += ("$(eol) $(grn)" + facet + ": $(red)"
- + escape_macros(element.get(facet)) + "$(nrm)")
+ for facet in sorted(facets):
+ message += ("$(eol) $(grn)%s: $(red)%s$(nrm)" %
+ (facet, escape_macros(element.get(facet))))
- elif 0 <= actor.owner.account.get("loglevel") <= 9:
- level = actor.owner.account.get("loglevel")
+ elif 0 <= actor.owner.account.get("loglevel", 0) <= 9:
+ level = actor.owner.account.get("loglevel", 0)