mirror of
https://github.com/mauiaaron/apple2.git
synced 2025-01-12 06:29:58 +00:00
Avoid doing stderr logging, period
This commit is contained in:
parent
17147ce662
commit
96e75f50ff
@ -276,7 +276,6 @@ PlayQueue_s *playq_createPlayQueue(const unsigned int *nodeIdPtr, unsigned long
|
|||||||
|
|
||||||
#define SELF_TEST 0
|
#define SELF_TEST 0
|
||||||
#if SELF_TEST
|
#if SELF_TEST
|
||||||
bool do_logging = true;
|
|
||||||
|
|
||||||
static void _test_creation(void) {
|
static void _test_creation(void) {
|
||||||
LOG("begin test");
|
LOG("begin test");
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
#define DO_STDERR_LOGGING 0
|
||||||
|
|
||||||
// log.c :
|
// log.c :
|
||||||
// - simple and not-particularly-performant logging functions
|
// - simple and not-particularly-performant logging functions
|
||||||
// - do not call in a tight loop!
|
// - do not call in a tight loop!
|
||||||
@ -21,9 +23,6 @@
|
|||||||
|
|
||||||
#define LOG_PATH_TEMPLATE "%s%sapple2ix_log.%u.txt"
|
#define LOG_PATH_TEMPLATE "%s%sapple2ix_log.%u.txt"
|
||||||
|
|
||||||
bool do_logging = true;
|
|
||||||
bool do_std_logging = true;
|
|
||||||
|
|
||||||
static int logFd = -1;
|
static int logFd = -1;
|
||||||
static off_t logSiz = 0;
|
static off_t logSiz = 0;
|
||||||
static const unsigned int logRotateSize = 1024 * 1024;
|
static const unsigned int logRotateSize = 1024 * 1024;
|
||||||
@ -100,17 +99,15 @@ void log_outputString(const char * const str) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UNLIKELY(!do_logging)) {
|
#if DO_STDERR_LOGGING
|
||||||
return;
|
{
|
||||||
}
|
|
||||||
|
|
||||||
if (do_std_logging) {
|
|
||||||
#if defined(__ANDROID__) && !defined(NDEBUG)
|
#if defined(__ANDROID__) && !defined(NDEBUG)
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "apple2ix", "%s", str);
|
__android_log_print(ANDROID_LOG_ERROR, "apple2ix", "%s", str);
|
||||||
#else
|
#else
|
||||||
fprintf(stderr, "%s\n", str);
|
fprintf(stderr, "%s\n", str);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (UNLIKELY(logFd < 0)) {
|
if (UNLIKELY(logFd < 0)) {
|
||||||
return;
|
return;
|
||||||
|
@ -23,12 +23,6 @@ extern GLenum safeGLGetError(void);
|
|||||||
# define safeGLGetError() 0
|
# define safeGLGetError() 0
|
||||||
#endif
|
#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
|
// initialize logging facility
|
||||||
void log_init(void);
|
void log_init(void);
|
||||||
|
|
||||||
@ -98,22 +92,22 @@ void log_outputString(const char * const str);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define LOG(...) \
|
#define LOG(...) \
|
||||||
if (LIKELY(do_logging)) { \
|
do { \
|
||||||
GLenum _glerr = safeGLGetError(); \
|
GLenum _glerr = safeGLGetError(); \
|
||||||
_LOG(__VA_ARGS__); \
|
_LOG(__VA_ARGS__); \
|
||||||
while ( (_glerr = safeGLGetError()) ) { \
|
while ( (_glerr = safeGLGetError()) ) { \
|
||||||
_LOG(__VA_ARGS__); \
|
_LOG(__VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
} //
|
} while(0) //
|
||||||
|
|
||||||
// GL_MAYBELOG() only logs if an OpenGL error occurred
|
// GL_MAYBELOG() only logs if an OpenGL error occurred
|
||||||
# define GL_MAYBELOG(...) \
|
# define GL_MAYBELOG(...) \
|
||||||
if (LIKELY(do_logging)) { \
|
do { \
|
||||||
GLenum _glerr = 0; \
|
GLenum _glerr = 0; \
|
||||||
while ( (_glerr = safeGLGetError()) ) { \
|
while ( (_glerr = safeGLGetError()) ) { \
|
||||||
_LOG(__VA_ARGS__); \
|
_LOG(__VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
} //
|
} while(0) //
|
||||||
|
|
||||||
#define QUIT_FUNCTION(x) exit(x)
|
#define QUIT_FUNCTION(x) exit(x)
|
||||||
|
|
||||||
|
@ -35,12 +35,6 @@ void test_breakpoint(void *arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void test_common_init(void) {
|
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);
|
extern void emulator_ctors(void);
|
||||||
emulator_ctors();
|
emulator_ctors();
|
||||||
|
|
||||||
|
@ -495,8 +495,7 @@ static void ncvideo_main_loop(void) {
|
|||||||
initscr();
|
initscr();
|
||||||
_nc_initColors();
|
_nc_initColors();
|
||||||
|
|
||||||
LOG("ncurses video main loop beginning, silencing STDERR logging ...");
|
LOG("ncurses video main loop beginning ...");
|
||||||
do_std_logging = false;
|
|
||||||
|
|
||||||
noecho(); // Do not echo output ...
|
noecho(); // Do not echo output ...
|
||||||
raw(); // Line buffering disabled ...
|
raw(); // Line buffering disabled ...
|
||||||
|
Loading…
x
Reference in New Issue
Block a user