mirror of
https://github.com/ryanoasis/nerd-fonts.git
synced 2024-09-19 09:51:48 +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:
parent
5c3bfbc2e0
commit
921fadaad9
1 changed files with 5 additions and 4 deletions
|
@ -36,10 +36,10 @@ class FontnameParser:
|
||||||
q = limit - len(r.groups()[1])
|
q = limit - len(r.groups()[1])
|
||||||
if q < 1:
|
if q < 1:
|
||||||
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]
|
new_n = r.groups()[0][:q] + r.groups()[1]
|
||||||
if new_n != n:
|
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
|
return new_n
|
||||||
|
|
||||||
def _shortened_name(self):
|
def _shortened_name(self):
|
||||||
|
@ -238,8 +238,9 @@ class FontnameParser:
|
||||||
def checklen(self, max_len, entry_id, name):
|
def checklen(self, max_len, entry_id, name):
|
||||||
"""Check the length of a name string and report violations"""
|
"""Check the length of a name string and report violations"""
|
||||||
if len(name) <= max_len:
|
if len(name) <= max_len:
|
||||||
return name
|
self.logger.debug('=====> {:18} ok ({:2} <={:2}): {}'.format(entry_id, len(name), max_len, name))
|
||||||
self.logger.error('{} too long ({} > {}): {}'.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
|
return name
|
||||||
|
|
||||||
def rename_font(self, font):
|
def rename_font(self, font):
|
||||||
|
|
Loading…
Reference in a new issue