diff options
author | Daniel Silverstone <dsilvers@netsurf-browser.org> | 2007-05-30 22:27:58 +0000 |
---|---|---|
committer | Daniel Silverstone <dsilvers@netsurf-browser.org> | 2007-05-30 22:27:58 +0000 |
commit | 25e22eb1f5046fdf9ef1d470b86faf640375de08 (patch) | |
tree | 9d4b5fd8f5dc258cb61888d0063a64498f412d42 | |
parent | 7bc1a41ea0f2188de75445e0e23993b6c6b0006f (diff) | |
download | netsurf-25e22eb1f5046fdf9ef1d470b86faf640375de08.tar.gz netsurf-25e22eb1f5046fdf9ef1d470b86faf640375de08.tar.bz2 |
Add a -v option to enable debug logging. Pass -v by default to the RO runimage.
svn path=/trunk/netsurf/; revision=3306
-rw-r--r-- | !NetSurf/!Run,feb | 4 | ||||
-rw-r--r-- | content/fetch.c | 6 | ||||
-rw-r--r-- | desktop/netsurf.c | 10 | ||||
-rw-r--r-- | desktop/netsurf.h | 1 | ||||
-rw-r--r-- | utils/log.h | 7 |
5 files changed, 22 insertions, 6 deletions
diff --git a/!NetSurf/!Run,feb b/!NetSurf/!Run,feb index 1629c42a2..7828c21fc 100644 --- a/!NetSurf/!Run,feb +++ b/!NetSurf/!Run,feb @@ -100,7 +100,7 @@ CDir <Wimp$ScrapDir>.WWW.NetSurf FontInstall NetSurf:Resources.Fonts. WimpSlot -min 2240k -max 2240k -Run <NetSurf$Dir>.!RunImage %*0 2><Wimp$ScrapDir>.WWW.NetSurf.Log +Run <NetSurf$Dir>.!RunImage -v %*0 2><Wimp$ScrapDir>.WWW.NetSurf.Log | Uninstall NetSurf-specific fonts -FontRemove NetSurf:Resources.Fonts.
\ No newline at end of file +FontRemove NetSurf:Resources.Fonts. diff --git a/content/fetch.c b/content/fetch.c index 2620f80b5..ed2c63670 100644 --- a/content/fetch.c +++ b/content/fetch.c @@ -248,7 +248,11 @@ void fetch_init(void) if (code != CURLE_OK) \ goto curl_easy_setopt_failed; - SETOPT(CURLOPT_VERBOSE, 1); + if (verbose_log) { + SETOPT(CURLOPT_VERBOSE, 1); + } else { + SETOPT(CURLOPT_VERBOSE, 0); + } SETOPT(CURLOPT_ERRORBUFFER, fetch_error_buffer); SETOPT(CURLOPT_WRITEFUNCTION, fetch_curl_data); SETOPT(CURLOPT_HEADERFUNCTION, fetch_curl_header); diff --git a/desktop/netsurf.c b/desktop/netsurf.c index 943ab4fcb..89d57341b 100644 --- a/desktop/netsurf.c +++ b/desktop/netsurf.c @@ -31,6 +31,7 @@ #include "netsurf/utils/utils.h" bool netsurf_quit = false; +bool verbose_log = false; static void netsurf_init(int argc, char** argv); static void netsurf_poll(void); @@ -66,6 +67,15 @@ void netsurf_init(int argc, char** argv) stdout = stderr; + if ((argc > 1) && (argv[1][0] == '-') && (argv[1][1] == 'v') && (argv[1][2] == 0)) { + int argcmv; + verbose_log = true; + for (argcmv = 2; argcmv < argc; argcmv++) { + argv[argcmv - 1] = argv[argcmv]; + } + argc--; + } + #ifdef _MEMDEBUG_H_ memdebug_memdebug("memdump"); #endif diff --git a/desktop/netsurf.h b/desktop/netsurf.h index a1865a604..cbffc9ccf 100644 --- a/desktop/netsurf.h +++ b/desktop/netsurf.h @@ -11,6 +11,7 @@ #include <stdbool.h> extern bool netsurf_quit; +extern bool verbose_log; extern const char * const netsurf_version; extern const int netsurf_version_major; extern const int netsurf_version_minor; diff --git a/utils/log.h b/utils/log.h index 6ad17bb0d..86a933a40 100644 --- a/utils/log.h +++ b/utils/log.h @@ -7,6 +7,7 @@ */ #include <stdio.h> +#include "netsurf/desktop/netsurf.h" #ifndef _NETSURF_LOG_H_ #define _NETSURF_LOG_H_ @@ -15,11 +16,11 @@ # define LOG(x) ((void) 0) #else # ifdef __GNUC__ -# define LOG(x) (printf(__FILE__ " %s %i: ", __PRETTY_FUNCTION__, __LINE__), printf x, fputc('\n', stdout)) +# define LOG(x) do { if (verbose_log) (printf(__FILE__ " %s %i: ", __PRETTY_FUNCTION__, __LINE__), printf x, fputc('\n', stdout)); } while (0) # elif defined(__CC_NORCROFT) -# define LOG(x) (printf(__FILE__ " %s %i: ", __func__, __LINE__), printf x, fputc('\n', stdout)) +# define LOG(x) do { if (verbose_log) (printf(__FILE__ " %s %i: ", __func__, __LINE__), printf x, fputc('\n', stdout)); } while (0) # else -# define LOG(x) (printf(__FILE__ " %i: ", __LINE__), printf x, fputc('\n', stdout)) +# define LOG(x) do { if (verbose_log) (printf(__FILE__ " %i: ", __LINE__), printf x, fputc('\n', stdout)); } while (0) # endif #endif |