diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-09-08 16:01:24 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-09-25 15:08:32 +0400 |
commit | 13d8671a1a71e77ca3c6b1ce3d13d200ddd778d1 (patch) | |
tree | d8a02a2b1601b5bff66d2b2a6987ecccc33e9dd1 /source/creator/creator.c | |
parent | 058e3f087e4db827e0dcb2b8ea662fa7cdc1ff6b (diff) |
Cycles: Add support of Glog logging
This commit makes it possible to use Glog library for the debug logging.
For now only possible when using CMake and in order to use the logging
the WITH_CYCLES_LOGGING configuration variable is to be enabled.
When this option is not enabled or when using Scons there's no difference
in Cycles behavior at all, when using logging and no output to the console
impact is gonna to be minimal.
This is done in order to make it possible to have debug logging persistent
in code (without need to add it when troubleshooting some bug and removing
it afterwards).
For now actual logging is not placed yet, only all the functions needed for
the logging are written and so.
Diffstat (limited to 'source/creator/creator.c')
-rw-r--r-- | source/creator/creator.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/source/creator/creator.c b/source/creator/creator.c index 3937ae18143..3511c9dc2cb 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -149,6 +149,10 @@ # include "libmv-capi.h" #endif +#ifdef WITH_CYCLES_LOGGING +# include "CCL_api.h" +#endif + /* from buildinfo.c */ #ifdef BUILD_DATE extern char build_date[]; @@ -309,6 +313,9 @@ static int print_help(int UNUSED(argc), const char **UNUSED(argv), void *data) #ifdef WITH_LIBMV BLI_argsPrintArgDoc(ba, "--debug-libmv"); #endif +#ifdef WITH_CYCLES_LOGGING + BLI_argsPrintArgDoc(ba, "--debug-cycles"); +#endif BLI_argsPrintArgDoc(ba, "--debug-memory"); BLI_argsPrintArgDoc(ba, "--debug-jobs"); BLI_argsPrintArgDoc(ba, "--debug-python"); @@ -450,6 +457,15 @@ static int debug_mode_libmv(int UNUSED(argc), const char **UNUSED(argv), void *U } #endif +#ifdef WITH_CYCLES_LOGGING +static int debug_mode_cycles(int UNUSED(argc), const char **UNUSED(argv), + void *UNUSED(data)) +{ + CCL_start_debug_logging(); + return 0; +} +#endif + static int debug_mode_memory(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data)) { MEM_set_memory_debug(); @@ -887,6 +903,8 @@ static int set_verbosity(int argc, const char **argv, void *UNUSED(data)) #ifdef WITH_LIBMV libmv_setLoggingVerbosity(level); +#elif defined(WITH_CYCLES_LOGGING) + CCL_logging_verbosity_set(level); #else (void)level; #endif @@ -1419,6 +1437,9 @@ static void setupArguments(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle) #ifdef WITH_LIBMV BLI_argsAdd(ba, 1, NULL, "--debug-libmv", "\n\tEnable debug messages from libmv library", debug_mode_libmv, NULL); #endif +#ifdef WITH_CYCLES_LOGGING + BLI_argsAdd(ba, 1, NULL, "--debug-cycles", "\n\tEnable debug messages from Cycles", debug_mode_cycles, NULL); +#endif BLI_argsAdd(ba, 1, NULL, "--debug-memory", "\n\tEnable fully guarded memory allocation and debugging", debug_mode_memory, NULL); BLI_argsAdd(ba, 1, NULL, "--debug-value", "<value>\n\tSet debug value of <value> on startup\n", set_debug_value, NULL); @@ -1583,6 +1604,8 @@ int main( #ifdef WITH_LIBMV libmv_initLogging(argv[0]); +#elif defined(WITH_CYCLES_DEBUG) + CCL_init_logging(argv[0]); #endif setCallbacks(); |