1
0
mirror of https://github.com/ryanoasis/nerd-fonts.git synced 2024-12-19 20:12:52 +02:00

name-parser: Unify name related error message format

[why]
It is hard to grep for all naming related errors, because there is no
common format.

[how]
Make them also visually similar and error cases easily spotted.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
Fini Jastrow 2023-04-20 16:42:15 +02:00
parent 5c3bfbc2e0
commit 921fadaad9

View File

@ -36,10 +36,10 @@ class FontnameParser:
q = limit - len(r.groups()[1])
if q < 1:
q = 1
self.logger.error('Shortening too long PS {}name: Garbage warning'. format(fam))
self.logger.error('====-< Shortening too long PS {}name: Garbage warning'. format(fam))
new_n = r.groups()[0][:q] + r.groups()[1]
if new_n != n:
self.logger.error('Shortening too long PS {}name: {} -> {}'.format(fam, n, new_n))
self.logger.error('====-< Shortening too long PS {}name: {} -> {}'.format(fam, n, new_n))
return new_n
def _shortened_name(self):
@ -238,8 +238,9 @@ class FontnameParser:
def checklen(self, max_len, entry_id, name):
"""Check the length of a name string and report violations"""
if len(name) <= max_len:
return name
self.logger.error('{} too long ({} > {}): {}'.format(entry_id, len(name), max_len, name))
self.logger.debug('=====> {:18} ok ({:2} <={:2}): {}'.format(entry_id, len(name), max_len, name))
else:
self.logger.error('====-< {:18} too long ({:2} > {:2}): {}'.format(entry_id, len(name), max_len, name))
return name
def rename_font(self, font):