Bug 1598531 - Output Base Profiler logging to stderr, so it is correctly sync'd with MOZ_LOG - r=gregtatum

This is especially useful when debugging both Base Profiler and Gecko Profiler,
so that their messages are correctly sequenced.

Differential Revision: https://phabricator.services.mozilla.com/D54447

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Gerald Squelart 2019-11-26 11:28:33 +00:00
Родитель 7148c5cf32
Коммит 8bd3b43665
1 изменённых файлов: 18 добавлений и 18 удалений

Просмотреть файл

@ -46,34 +46,34 @@ bool BaseProfilerLogTest(int aLevelToTest);
// These are for MOZ_BASE_PROFILER_LOGGING and above. It's the default logging
// level for the profiler, and should be used sparingly.
#define LOG_TEST BaseProfilerLogTest(3)
#define LOG(arg, ...) \
do { \
if (LOG_TEST) { \
printf("[I %d/%d] " arg "\n", profiler_current_process_id(), \
profiler_current_thread_id(), ##__VA_ARGS__); \
} \
#define LOG(arg, ...) \
do { \
if (LOG_TEST) { \
fprintf(stderr, "[I %d/%d] " arg "\n", profiler_current_process_id(), \
profiler_current_thread_id(), ##__VA_ARGS__); \
} \
} while (0)
// These are for MOZ_BASE_PROFILER_DEBUG_LOGGING. It should be used for logging
// that is somewhat more verbose than LOG.
#define DEBUG_LOG_TEST BaseProfilerLogTest(4)
#define DEBUG_LOG(arg, ...) \
do { \
if (DEBUG_LOG_TEST) { \
printf("[D %d/%d] " arg "\n", profiler_current_process_id(), \
profiler_current_thread_id(), ##__VA_ARGS__); \
} \
#define DEBUG_LOG(arg, ...) \
do { \
if (DEBUG_LOG_TEST) { \
fprintf(stderr, "[D %d/%d] " arg "\n", profiler_current_process_id(), \
profiler_current_thread_id(), ##__VA_ARGS__); \
} \
} while (0)
// These are for MOZ_BASE_PROFILER_VERBOSE_LOGGING. It should be used for
// logging that is somewhat more verbose than DEBUG_LOG.
#define VERBOSE_LOG_TEST BaseProfilerLogTest(5)
#define VERBOSE_LOG(arg, ...) \
do { \
if (VERBOSE_LOG_TEST) { \
printf("[V %d/%d] " arg "\n", profiler_current_process_id(), \
profiler_current_thread_id(), ##__VA_ARGS__); \
} \
#define VERBOSE_LOG(arg, ...) \
do { \
if (VERBOSE_LOG_TEST) { \
fprintf(stderr, "[V %d/%d] " arg "\n", profiler_current_process_id(), \
profiler_current_thread_id(), ##__VA_ARGS__); \
} \
} while (0)
namespace mozilla {