Avoid doing stderr logging, period

This commit is contained in:
Aaron Culliney 2019-06-28 21:10:07 -07:00
parent 17147ce662
commit 96e75f50ff
5 changed files with 10 additions and 27 deletions

View File

@ -276,7 +276,6 @@ PlayQueue_s *playq_createPlayQueue(const unsigned int *nodeIdPtr, unsigned long
#define SELF_TEST 0
#if SELF_TEST
bool do_logging = true;
static void _test_creation(void) {
LOG("begin test");

View File

@ -11,6 +11,8 @@
#include "common.h"
#define DO_STDERR_LOGGING 0
// log.c :
// - simple and not-particularly-performant logging functions
// - do not call in a tight loop!
@ -21,9 +23,6 @@
#define LOG_PATH_TEMPLATE "%s%sapple2ix_log.%u.txt"
bool do_logging = true;
bool do_std_logging = true;
static int logFd = -1;
static off_t logSiz = 0;
static const unsigned int logRotateSize = 1024 * 1024;
@ -100,17 +99,15 @@ void log_outputString(const char * const str) {
return;
}
if (UNLIKELY(!do_logging)) {
return;
}
if (do_std_logging) {
#if DO_STDERR_LOGGING
{
#if defined(__ANDROID__) && !defined(NDEBUG)
__android_log_print(ANDROID_LOG_ERROR, "apple2ix", "%s", str);
#else
fprintf(stderr, "%s\n", str);
#endif
}
#endif
if (UNLIKELY(logFd < 0)) {
return;

View File

@ -23,12 +23,6 @@ extern GLenum safeGLGetError(void);
# define safeGLGetError() 0
#endif
// global logging kill switch
extern bool do_logging;
// log to the standard log facility (e.g., stderr)
extern bool do_std_logging;
// initialize logging facility
void log_init(void);
@ -98,22 +92,22 @@ void log_outputString(const char * const str);
#endif
#define LOG(...) \
if (LIKELY(do_logging)) { \
do { \
GLenum _glerr = safeGLGetError(); \
_LOG(__VA_ARGS__); \
while ( (_glerr = safeGLGetError()) ) { \
_LOG(__VA_ARGS__); \
} \
} //
} while(0) //
// GL_MAYBELOG() only logs if an OpenGL error occurred
# define GL_MAYBELOG(...) \
if (LIKELY(do_logging)) { \
do { \
GLenum _glerr = 0; \
while ( (_glerr = safeGLGetError()) ) { \
_LOG(__VA_ARGS__); \
} \
} //
} while(0) //
#define QUIT_FUNCTION(x) exit(x)

View File

@ -35,12 +35,6 @@ void test_breakpoint(void *arg) {
}
void test_common_init(void) {
#if __ANDROID__
// tags help us wade through log soup
#else
do_std_logging = false;// silence regular emulator logging
#endif
extern void emulator_ctors(void);
emulator_ctors();

View File

@ -495,8 +495,7 @@ static void ncvideo_main_loop(void) {
initscr();
_nc_initColors();
LOG("ncurses video main loop beginning, silencing STDERR logging ...");
do_std_logging = false;
LOG("ncurses video main loop beginning ...");
noecho(); // Do not echo output ...
raw(); // Line buffering disabled ...