def format(self, msg, ignore_linted=False): if not isinstance(msg, LintMessage): self.logger.warning(msg) self.emitted = True return if msg.level >= self._level: if not msg.msgid: msg.msgid = "unknown" # Format the message level and message identifier key = "{0} {1}".format(LEVELS[msg.level], msg.msgid) if not ignore_linted: linted_flag = False try: linted_flag = linted(action=self.action, manifest=self.manifest, lint_id=msg.msgid) except DuplicateLintedAttrException as err: lint_key = ("{0} pkglint001.6".format( LEVELS[ERROR])) self.logger.warning("{0}{1}".format( lint_key.ljust(34), _("Logging error: {0}").format( err))) if linted_flag: # we may have asked not to report errors # that have been marked as pkg.linted if self.engine: report = self.engine.get_param( "pkglint001.5.report-linted") if report and \ report.lower() == "false": return key = ("{0} pkglint001.5".format( LEVELS[INFO])) linted_msg = _( "Linted message: {id} " "{msg}").format( id=msg.msgid, msg=msg) self.logger.warning("{0}{1}".format( key.ljust(34), linted_msg)) return self.logger.warning("{0}{1}".format(key.ljust(34), msg.msg)) # We only treat errors, and criticals as being worthy # of a flag (pkglint returns non-zero if self.emitted) if msg.level > WARNING: self.emitted = True
def format(self, msg, ignore_linted=False): if not isinstance(msg, LintMessage): self.logger.warning(msg) self.emitted = True return if msg.level >= self._level: if not msg.msgid: msg.msgid = "unknown" # Format the message level and message identifier key = "%s %s" % (LEVELS[msg.level], msg.msgid) if not ignore_linted: linted_flag = False try: linted_flag = linted(action=self.action, manifest=self.manifest, lint_id=msg.msgid) except DuplicateLintedAttrException, err: lint_key = ("%s pkglint001.6" % LEVELS[ERROR]) self.logger.warning("%s%s" % (lint_key.ljust(34), _("Logging error: %s") % err)) if linted_flag: # we may have asked not to report errors # that have been marked as pkg.linted if self.engine: report = self.engine.get_param( "pkglint001.5.report-linted") if report and \ report.lower() == "false": return key = ("%s pkglint001.5" % LEVELS[INFO]) linted_msg = _( "Linted message: %(id)s " "%(msg)s") % \ {"id": msg.msgid, "msg": msg} self.logger.warning("%s%s" % (key.ljust(34), linted_msg)) return self.logger.warning("%s%s" % (key.ljust(34), msg.msg)) # We only treat errors, and criticals as being worthy # of a flag (pkglint returns non-zero if self.emitted) if msg.level > WARNING: self.emitted = True