Add a -v option to enable debug logging. Pass -v by default to the RO runimage.

svn path=/trunk/netsurf/; revision=3306
This commit is contained in:
Daniel Silverstone 2007-05-30 22:27:58 +00:00
parent 7bc1a41ea0
commit 25e22eb1f5
5 changed files with 22 additions and 6 deletions

View File

@ -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.
FontRemove NetSurf:Resources.Fonts.

View File

@ -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);

View File

@ -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

View File

@ -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;

View File

@ -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