notcurses-tester: accept -l to enable all logging

This commit is contained in:
nick black 2021-04-24 05:18:04 -04:00
parent dc87bd7c79
commit e29701cac3
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
3 changed files with 14 additions and 4 deletions

View File

@ -8,7 +8,7 @@ notcurses-tester - Notcurses unit testing
# SYNOPSIS # SYNOPSIS
**notcurses-tester** [**-p datadir**] **notcurses-tester** [**-p datadir**] [**-l**]
# DESCRIPTION # DESCRIPTION
@ -18,7 +18,12 @@ if these are in an irregular location, supply **-p**.
# OPTIONS # OPTIONS
**-p** ***path***: Look in the specified ***path*** for data files.
**-l**: Enable all possible diagnostics/logging.
# NOTES # NOTES
Valid **TERM** and **LANG** environment variables are necessary for Valid **TERM** and **LANG** environment variables are necessary for
**notcurses-tester**'s correct operation. **notcurses-tester**'s correct operation.

View File

@ -140,6 +140,8 @@ highcontrast(uint32_t bchannel){
} }
// wants coordinates within the sprixel, not absolute // wants coordinates within the sprixel, not absolute
// FIXME if plane is not wholly on-screen, probably need to toss plane,
// at least for this rendering cycle
static void static void
paint_sprixel(const ncplane* p, const nccell* vis, struct crender* crender, paint_sprixel(const ncplane* p, const nccell* vis, struct crender* crender,
int y, int x){ int y, int x){

View File

@ -12,13 +12,14 @@
#include <filesystem> #include <filesystem>
#include <langinfo.h> #include <langinfo.h>
static const char* datadir = NOTCURSES_SHARE; const char* datadir = NOTCURSES_SHARE;
ncloglevel_e loglevel = NCLOGLEVEL_SILENT;
auto testing_notcurses() -> struct notcurses* { auto testing_notcurses() -> struct notcurses* {
notcurses_options nopts{}; notcurses_options nopts{};
// FIXME get loglevel from command line. enabling it by default leads to // get loglevel from command line. enabling it by default leads to
// more confusion than useful information, so leave it off by default. // more confusion than useful information, so leave it off by default.
//nopts.loglevel = NCLOGLEVEL_TRACE; nopts.loglevel = loglevel;
nopts.flags = NCOPTION_SUPPRESS_BANNERS | NCOPTION_NO_ALTERNATE_SCREEN; nopts.flags = NCOPTION_SUPPRESS_BANNERS | NCOPTION_NO_ALTERNATE_SCREEN;
auto nc = notcurses_init(&nopts, nullptr); auto nc = notcurses_init(&nopts, nullptr);
return nc; return nc;
@ -39,6 +40,8 @@ handle_opts(const char** argv){
inarg = false; inarg = false;
}else if(strcmp(*argv, "-p") == 0){ }else if(strcmp(*argv, "-p") == 0){
inarg = true; inarg = true;
}else if(strcmp(*argv, "-l") == 0){
loglevel = NCLOGLEVEL_TRACE;
} }
++argv; ++argv;
} }