mirror of
https://github.com/ryanoasis/nerd-fonts.git
synced 2024-09-19 09:51:48 +02:00
font-patcher: Do not log to file always
[why] Maybe it is not a good idea to always create the log file, as most people will never look into it. The main reason for it was the gotta-patch-em script so that one can check after lots of runs what the details were. [how] Introduce parameter to --debug option. 0 = no debug output 1 = log to file only (previously always selected) 2 = log to stdout only 3 = log to file and stdout (previous default for --debug) Just specifying --default equals now --debug 2. The gotta-patch-em runs now with --debug 1. Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
parent
5c968b80ae
commit
80664a90fe
2 changed files with 16 additions and 13 deletions
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
# Nerd Fonts Version: 3.0.0
|
||||
# Script Version: 1.4.4
|
||||
# Script Version: 1.4.5
|
||||
#
|
||||
# You can supply options to the font-patcher via environment variable NERDFONTS
|
||||
# That option will override the defaults (also defaults of THIS script).
|
||||
|
@ -246,6 +246,8 @@ function patch_font {
|
|||
echo >&2 "# Could not find project parent directory"
|
||||
exit 3
|
||||
}
|
||||
# Add logfile always (but can be overridden by config_patch_flags in config.cfg and env var NERDFONTS)
|
||||
config_patch_flags="--debug 1 ${config_patch_flags}"
|
||||
# Use absolute path to allow fontforge being an AppImage (used in CI)
|
||||
PWD=`pwd`
|
||||
# Create "Nerd Font"
|
||||
|
|
25
font-patcher
25
font-patcher
|
@ -1832,7 +1832,7 @@ def setup_arguments():
|
|||
progressbars_group_parser.add_argument('--progressbars', dest='progressbars', action='store_true', help='Show percentage completion progress bars per Glyph Set (default)')
|
||||
progressbars_group_parser.add_argument('--no-progressbars', dest='progressbars', action='store_false', help='Don\'t show percentage completion progress bars per Glyph Set')
|
||||
parser.set_defaults(progressbars=True)
|
||||
parser.add_argument('--debug', dest='debugmode', default=False, action='store_true', help='Verbose mode')
|
||||
parser.add_argument('--debug', dest='debugmode', default=0, type=int, nargs='?', help='Verbose mode (optional: 1=just to file; 2*=just to terminal; 3=display and file)', const=2, choices=range(0, 3 + 1))
|
||||
parser.add_argument('--dry', dest='dry_run', default=False, action='store_true', help='Do neither patch nor store the font, to check naming')
|
||||
parser.add_argument('--xavgcharwidth', dest='xavgwidth', default=None, type=int, nargs='?', help='Adjust xAvgCharWidth (optional: concrete value)', const=True)
|
||||
# --xavgcharwidth for compatibility with old applications like notepad and non-latin fonts
|
||||
|
@ -1955,21 +1955,22 @@ def main():
|
|||
global logger
|
||||
logger = logging.getLogger(os.path.basename(args.font))
|
||||
logger.setLevel(logging.DEBUG)
|
||||
log_to_file = True
|
||||
try:
|
||||
f_handler = logging.FileHandler('font-patcher-log.txt')
|
||||
f_handler.setFormatter(logging.Formatter('%(levelname)s: %(name)s %(message)s'))
|
||||
logger.addHandler(f_handler)
|
||||
except:
|
||||
log_to_file = False
|
||||
logger.debug(allversions)
|
||||
logger.debug("Options %s", repr(sys.argv[1:]))
|
||||
log_to_file = (args.debugmode & 1 == 1)
|
||||
if log_to_file:
|
||||
try:
|
||||
f_handler = logging.FileHandler('font-patcher-log.txt')
|
||||
f_handler.setFormatter(logging.Formatter('%(levelname)s: %(name)s %(message)s'))
|
||||
logger.addHandler(f_handler)
|
||||
except:
|
||||
log_to_file = False
|
||||
logger.debug(allversions)
|
||||
logger.debug("Options %s", repr(sys.argv[1:]))
|
||||
c_handler = logging.StreamHandler(stream=sys.stdout)
|
||||
c_handler.setFormatter(logging.Formatter('%(levelname)s: %(message)s'))
|
||||
if not args.debugmode:
|
||||
if not (args.debugmode & 2 == 2):
|
||||
c_handler.setLevel(logging.INFO)
|
||||
logger.addHandler(c_handler)
|
||||
if not log_to_file:
|
||||
if (args.debugmode & 1 == 1) and not log_to_file:
|
||||
logger.info("Can not write logfile, disabling")
|
||||
logger.debug("Naming mode %d", args.makegroups)
|
||||
|
||||
|
|
Loading…
Reference in a new issue