Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/da5d093085eb42bc536ec35b4f94d80a3c3b81f1
...commit
http://git.netsurf-browser.org/netsurf.git/commit/da5d093085eb42bc536ec35b4f94d80a3c3b81f1
...tree
http://git.netsurf-browser.org/netsurf.git/tree/da5d093085eb42bc536ec35b4f94d80a3c3b81f1
The branch, vince/nslog has been updated
via da5d093085eb42bc536ec35b4f94d80a3c3b81f1 (commit)
via b3eb010d6323d1480fa8275f2e0d7159fbdd0451 (commit)
from ed79b4661c6af4b4e0de31e737b0f079e10b4870 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=da5d093085eb42bc536ec35b4f94d80a3c3b81f1
commit da5d093085eb42bc536ec35b4f94d80a3c3b81f1
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>
Use coccinelle to change logging macro calls in c++
for F in $(git ls-files '*.cpp');do spatch --c++ --sp-file foo.cocci
--in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
diff --git a/frontends/beos/fetch_rsrc.cpp b/frontends/beos/fetch_rsrc.cpp
index 3adf4e5..ae36483 100644
--- a/frontends/beos/fetch_rsrc.cpp
+++ b/frontends/beos/fetch_rsrc.cpp
@@ -164,7 +164,7 @@ static bool fetch_rsrc_process(struct fetch_rsrc_context *c)
* rsrc://[TYPE][@NUM]/name[,mime]
*/
- LOG("*** Processing %s", c->url);
+ NSLOG(netsurf, INFO, "*** Processing %s", c->url);
if (strlen(c->url) < 7) {
/* 7 is the minimum possible length (rsrc://) */
@@ -201,11 +201,13 @@ static bool fetch_rsrc_process(struct fetch_rsrc_context
*c)
uint8 c1, c2, c3, c4;
if (sscanf(params, "%c%c%c%c", &c1, &c2, &c3, &c4) > 3) {
type = c1 << 24 | c2 << 16 | c3 << 8 | c4;
- LOG("fetch_rsrc: type:%4.4s\n", (char *)&type);
+ NSLOG(netsurf, INFO, "fetch_rsrc: type:%4.4s\n",
+ (char *)&type);
}
}
- LOG("fetch_rsrc: 0x%08lx, %ld, '%s'\n", type, id, c->name);
+ NSLOG(netsurf, INFO, "fetch_rsrc: 0x%08lx, %ld, '%s'\n", type, id,
+ c->name);
bool found;
if (id)
diff --git a/frontends/beos/gui.cpp b/frontends/beos/gui.cpp
index 6d0cce0..f2c9917 100644
--- a/frontends/beos/gui.cpp
+++ b/frontends/beos/gui.cpp
@@ -112,7 +112,7 @@ static int sEventPipe[2];
/* exported function defined in beos/gui.h */
nserror beos_warn_user(const char *warning, const char *detail)
{
- LOG("warn_user: %s (%s)", warning, detail);
+ NSLOG(netsurf, INFO, "warn_user: %s (%s)", warning, detail);
BAlert *alert;
BString text(warning);
if (detail)
@@ -388,7 +388,7 @@ static nsurl *gui_get_resource_url(const char *path)
path = "favicon.png";
u << path;
- LOG("(%s) -> '%s'\n", path, u.String());
+ NSLOG(netsurf, INFO, "(%s) -> '%s'\n", path, u.String());
nsurl_create(u.String(), &url);
return url;
}
diff --git a/frontends/beos/plotters.cpp b/frontends/beos/plotters.cpp
index c77e635..c4903e0 100644
--- a/frontends/beos/plotters.cpp
+++ b/frontends/beos/plotters.cpp
@@ -538,7 +538,7 @@ nsbeos_plot_path(const struct redraw_context *ctx,
}
if (p[0] != PLOTTER_PATH_MOVE) {
- LOG("path doesn't start with a move");
+ NSLOG(netsurf, INFO, "path doesn't start with a move");
return NSERROR_INVALID;
}
@@ -563,7 +563,7 @@ nsbeos_plot_path(const struct redraw_context *ctx,
shape.BezierTo(pt);
i += 7;
} else {
- LOG("bad path command %f", p[i]);
+ NSLOG(netsurf, INFO, "bad path command %f", p[i]);
return NSERROR_INVALID;
}
}
diff --git a/frontends/beos/scaffolding.cpp b/frontends/beos/scaffolding.cpp
index 426afff..e6fb6e5 100644
--- a/frontends/beos/scaffolding.cpp
+++ b/frontends/beos/scaffolding.cpp
@@ -854,7 +854,9 @@ void nsbeos_scaffolding_dispatch_event(nsbeos_scaffolding
*scaffold, BMessage *m
bw = nsbeos_get_browser_for_gui(scaffold->top_level);
bool reloadAll = false;
- LOG("nsbeos_scaffolding_dispatch_event() what = 0x%08lx",
message->what);
+ NSLOG(netsurf, INFO,
+ "nsbeos_scaffolding_dispatch_event() what = 0x%08lx",
+ message->what);
switch (message->what) {
case B_QUIT_REQUESTED:
nsbeos_scaffolding_destroy(scaffold);
@@ -997,7 +999,7 @@ void nsbeos_scaffolding_dispatch_event(nsbeos_scaffolding
*scaffold, BMessage *m
browser_window_key_press(bw, NS_KEY_PASTE);
break;
case B_SELECT_ALL:
- LOG("Selecting all text");
+ NSLOG(netsurf, INFO, "Selecting all text");
browser_window_key_press(bw, NS_KEY_SELECT_ALL);
break;
case B_NETPOSITIVE_BACK:
@@ -1445,7 +1447,7 @@ static void recursively_set_menu_items_target(BMenu
*menu, BHandler *handler)
void nsbeos_attach_toplevel_view(nsbeos_scaffolding *g, BView *view)
{
- LOG("Attaching view to scaffolding %p", g);
+ NSLOG(netsurf, INFO, "Attaching view to scaffolding %p", g);
// this is a replicant,... and it went bad
if (!g->window) {
@@ -1723,7 +1725,8 @@ nsbeos_scaffolding *nsbeos_new_scaffolding(struct
gui_window *toplevel)
{
struct beos_scaffolding *g = (struct beos_scaffolding
*)malloc(sizeof(*g));
- LOG("Constructing a scaffold of %p for gui_window %p", g, toplevel);
+ NSLOG(netsurf, INFO,
+ "Constructing a scaffold of %p for gui_window %p", g, toplevel);
g->top_level = toplevel;
g->being_destroyed = 0;
diff --git a/frontends/beos/schedule.cpp b/frontends/beos/schedule.cpp
index 92816c5..552a7cd 100644
--- a/frontends/beos/schedule.cpp
+++ b/frontends/beos/schedule.cpp
@@ -83,7 +83,7 @@ schedule_remove(void (*callback)(void *p), void *p)
nserror beos_schedule(int t, void (*callback)(void *p), void *p)
{
- LOG("t:%d cb:%p p:%p", t, cb->callback, cb->context);
+ NSLOG(netsurf, INFO, "t:%d cb:%p p:%p", t, cb->callback, cb->context);
if (callbacks == NULL) {
callbacks = new BList;
@@ -113,7 +113,7 @@ nserror beos_schedule(int t, void (*callback)(void *p),
void *p)
bool
schedule_run(void)
{
- LOG("schedule_run()");
+ NSLOG(netsurf, INFO, "schedule_run()");
earliest_callback_timeout = B_INFINITE_TIMEOUT;
if (callbacks == NULL)
@@ -122,7 +122,8 @@ schedule_run(void)
bigtime_t now = system_time();
int32 i;
- LOG("Checking %ld callbacks to for deadline.", this_run->CountItems());
+ NSLOG(netsurf, INFO, "Checking %ld callbacks to for deadline.",
+ this_run->CountItems());
/* Run all the callbacks which made it this far. */
for (i = 0; i < callbacks->CountItems(); ) {
@@ -134,7 +135,8 @@ schedule_run(void)
i++;
continue;
}
- LOG("Running callbacks %p(%p).", cb->callback, cb->context);
+ NSLOG(netsurf, INFO, "Running callbacks %p(%p).",
+ cb->callback, cb->context);
if (!cb->callback_killed)
cb->callback(cb->context);
callbacks->RemoveItem(cb);
diff --git a/frontends/beos/throbber.cpp b/frontends/beos/throbber.cpp
index fe40b3e..27ed423 100644
--- a/frontends/beos/throbber.cpp
+++ b/frontends/beos/throbber.cpp
@@ -50,14 +50,17 @@ bool nsbeos_throbber_initialise_from_png(const int frames,
...)
if (frames < 2) {
/* we need at least two frames - one for idle, one for active */
- LOG("Insufficent number of frames in throbber animation!");
- LOG("(called with %d frames, where 2 is a minimum.)", frames);
+ NSLOG(netsurf, INFO,
+ "Insufficent number of frames in throbber animation!");
+ NSLOG(netsurf, INFO,
+ "(called with %d frames, where 2 is a minimum.)",
+ frames);
return false;
}
BResources *res = get_app_resources();
if (res == NULL) {
- LOG("Can't find resources for throbber!");
+ NSLOG(netsurf, INFO, "Can't find resources for throbber!");
return false;
}
@@ -74,14 +77,17 @@ bool nsbeos_throbber_initialise_from_png(const int frames,
...)
data = res->LoadResource('data', fn, &size);
throb->framedata[i] = NULL;
if (!data) {
- LOG("Error when loading resource %s", fn);
+ NSLOG(netsurf, INFO, "Error when loading resource %s",
+ fn);
errors_when_loading = true;
continue;
}
BMemoryIO mem(data, size);
throb->framedata[i] = BTranslationUtils::GetBitmap(&mem);
if (throb->framedata[i] == NULL) {
- LOG("Error when loading %s: GetBitmap() returned NULL",
fn);
+ NSLOG(netsurf, INFO,
+ "Error when loading %s: GetBitmap() returned
NULL",
+ fn);
errors_when_loading = true;
}
}
diff --git a/frontends/beos/window.cpp b/frontends/beos/window.cpp
index 7d59b36..c6e2aad 100644
--- a/frontends/beos/window.cpp
+++ b/frontends/beos/window.cpp
@@ -354,7 +354,8 @@ static struct gui_window *gui_window_create(struct
browser_window *bw,
return 0;
}
- LOG("Creating gui window %p for browser window %p", g, bw);
+ NSLOG(netsurf, INFO, "Creating gui window %p for browser window %p",
+ g, bw);
g->bw = bw;
g->mouse.state = 0;
@@ -933,10 +934,10 @@ static void gui_window_destroy(struct gui_window *g)
g->next->prev = g->prev;
- LOG("Destroying gui_window %p", g);
+ NSLOG(netsurf, INFO, "Destroying gui_window %p", g);
assert(g != NULL);
assert(g->bw != NULL);
- LOG(" Scaffolding: %p", g->scaffold);
+ NSLOG(netsurf, INFO, " Scaffolding: %p", g->scaffold);
if (g->view == NULL)
return;
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=b3eb010d6323d1480fa8275f2e0d7159fbdd0451
commit b3eb010d6323d1480fa8275f2e0d7159fbdd0451
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>
update fetch debug logging to use catagory
diff --git a/content/fetch.c b/content/fetch.c
index fc72d13..7665029 100644
--- a/content/fetch.c
+++ b/content/fetch.c
@@ -60,16 +60,6 @@
#include "javascript/fetcher.h"
#include "content/urldb.h"
-/* Define this to turn on verbose fetch logging */
-#undef DEBUG_FETCH_VERBOSE
-
-/** Verbose fetcher logging */
-#ifdef DEBUG_FETCH_VERBOSE
-#define FETCH_LOG(x...) LOG(x...)
-#else
-#define FETCH_LOG(x...)
-#endif
-
/** The maximum number of fetchers that can be added */
#define MAX_FETCHERS 10
@@ -158,8 +148,10 @@ static int get_fetcher_for_scheme(lwc_string *scheme)
static bool fetch_dispatch_job(struct fetch *fetch)
{
RING_REMOVE(queue_ring, fetch);
- FETCH_LOG("Attempting to start fetch %p, fetcher %p, url %s", fetch,
- fetch->fetcher_handle, nsurl_access(fetch->url));
+ NSLOG(fetch, DEBUG,
+ "Attempting to start fetch %p, fetcher %p, url %s", fetch,
+ fetch->fetcher_handle,
+ nsurl_access(fetch->url));
if (!fetchers[fetch->fetcherd].ops.start(fetch->fetcher_handle)) {
RING_INSERT(queue_ring, fetch); /* Put it back on the end of
the queue */
@@ -210,14 +202,13 @@ static bool fetch_choose_and_dispatch(void)
static void dump_rings(void)
{
-#ifdef DEBUG_FETCH_VERBOSE
struct fetch *q;
struct fetch *f;
q = queue_ring;
if (q) {
do {
- NSLOG(netsurf, INFO, "queue_ring: %s",
+ NSLOG(fetch, DEBUG, "queue_ring: %s",
nsurl_access(q->url));
q = q->r_next;
} while (q != queue_ring);
@@ -225,12 +216,11 @@ static void dump_rings(void)
f = fetch_ring;
if (f) {
do {
- NSLOG(netsurf, INFO, "fetch_ring: %s",
+ NSLOG(fetch, DEBUG, "fetch_ring: %s",
nsurl_access(f->url));
f = f->r_next;
} while (f != fetch_ring);
}
-#endif
}
/**
@@ -246,7 +236,10 @@ static bool fetch_dispatch_jobs(void)
RING_GETSIZE(struct fetch, queue_ring, all_queued);
RING_GETSIZE(struct fetch, fetch_ring, all_active);
- FETCH_LOG("queue_ring %i, fetch_ring %i", all_queued, all_active);
+ NSLOG(fetch, DEBUG,
+ "queue_ring %i, fetch_ring %i",
+ all_queued,
+ all_active);
dump_rings();
while ((all_queued != 0) &&
@@ -254,12 +247,14 @@ static bool fetch_dispatch_jobs(void)
fetch_choose_and_dispatch()) {
all_queued--;
all_active++;
- FETCH_LOG("%d queued, %d fetching",
- all_queued, all_active);
+ NSLOG(fetch, DEBUG,
+ "%d queued, %d fetching",
+ all_queued,
+ all_active);
}
- FETCH_LOG("Fetch ring is now %d elements.", all_active);
- FETCH_LOG("Queue ring is now %d elements.", all_queued);
+ NSLOG(fetch, DEBUG, "Fetch ring is now %d elements.", all_active);
+ NSLOG(fetch, DEBUG, "Queue ring is now %d elements.", all_queued);
return (all_active > 0);
}
@@ -269,7 +264,7 @@ static void fetcher_poll(void *unused)
int fetcherd;
if (fetch_dispatch_jobs()) {
- FETCH_LOG("Polling fetchers");
+ NSLOG(fetch, DEBUG, "Polling fetchers");
for (fetcherd = 0; fetcherd < MAX_FETCHERS; fetcherd++) {
if (fetchers[fetcherd].refcount > 0) {
/* fetcher present */
@@ -343,7 +338,7 @@ void fetcher_quit(void)
* the reference count to allow the fetcher to
* be stopped.
*/
- NSLOG(netsurf, INFO,
+ NSLOG(fetch, INFO,
"Fetcher for scheme %s still has %d active users
at quit.",
lwc_string_data(fetchers[fetcherd].scheme),
fetchers[fetcherd].refcount);
@@ -396,12 +391,12 @@ fetch_fdset(fd_set *read_fd_set,
int fetcherd; /* fetcher index */
if (!fetch_dispatch_jobs()) {
- FETCH_LOG("No jobs");
+ NSLOG(fetch, DEBUG, "No jobs");
*maxfd_out = -1;
return NSERROR_OK;
}
- FETCH_LOG("Polling fetchers");
+ NSLOG(fetch, DEBUG, "Polling fetchers");
for (fetcherd = 0; fetcherd < MAX_FETCHERS; fetcherd++) {
if (fetchers[fetcherd].refcount > 0) {
@@ -484,7 +479,7 @@ fetch_start(nsurl *url,
return NSERROR_NO_FETCH_HANDLER;
}
- FETCH_LOG("fetch %p, url '%s'", fetch, nsurl_access(url));
+ NSLOG(fetch, DEBUG, "fetch %p, url '%s'", fetch, nsurl_access(url));
/* construct a new fetch structure */
fetch->callback = callback;
@@ -576,7 +571,7 @@ fetch_start(nsurl *url,
/* Ask the queue to run. */
if (fetch_dispatch_jobs()) {
- FETCH_LOG("scheduling poll");
+ NSLOG(fetch, DEBUG, "scheduling poll");
/* schedule active fetchers to run again in 10ms */
guit->misc->schedule(10, fetcher_poll, NULL);
}
@@ -589,7 +584,8 @@ fetch_start(nsurl *url,
void fetch_abort(struct fetch *f)
{
assert(f);
- FETCH_LOG("fetch %p, fetcher %p, url '%s'", f, f->fetcher_handle,
+ NSLOG(fetch, DEBUG,
+ "fetch %p, fetcher %p, url '%s'", f, f->fetcher_handle,
nsurl_access(f->url));
fetchers[f->fetcherd].ops.abort(f->fetcher_handle);
}
@@ -597,7 +593,10 @@ void fetch_abort(struct fetch *f)
/* exported interface documented in content/fetch.h */
void fetch_free(struct fetch *f)
{
- FETCH_LOG("Freeing fetch %p, fetcher %p", f, f->fetcher_handle);
+ NSLOG(fetch, DEBUG,
+ "Freeing fetch %p, fetcher %p",
+ f,
+ f->fetcher_handle);
fetchers[f->fetcherd].ops.free(f->fetcher_handle);
@@ -723,7 +722,8 @@ void fetch_multipart_data_destroy(struct
fetch_multipart_data *list)
free(list->name);
free(list->value);
if (list->file) {
- FETCH_LOG("Freeing rawfile: %s", list->rawfile);
+ NSLOG(fetch, DEBUG,
+ "Freeing rawfile: %s", list->rawfile);
free(list->rawfile);
}
free(list);
@@ -741,8 +741,13 @@ fetch_send_callback(const fetch_msg *msg, struct fetch
*fetch)
/* exported interface documented in content/fetch.h */
void fetch_remove_from_queues(struct fetch *fetch)
{
- FETCH_LOG("Fetch %p, fetcher %p can be freed",
- fetch, fetch->fetcher_handle);
+ int all_active;
+ int all_queued;
+
+ NSLOG(fetch, DEBUG,
+ "Fetch %p, fetcher %p can be freed",
+ fetch,
+ fetch->fetcher_handle);
/* Go ahead and free the fetch properly now */
if (fetch->fetch_is_active) {
@@ -751,24 +756,19 @@ void fetch_remove_from_queues(struct fetch *fetch)
RING_REMOVE(queue_ring, fetch);
}
-#ifdef DEBUG_FETCH_VERBOSE
- int all_active;
- int all_queued;
RING_GETSIZE(struct fetch, fetch_ring, all_active);
RING_GETSIZE(struct fetch, queue_ring, all_queued);
- NSLOG(netsurf, INFO, "Fetch ring is now %d elements.", all_active);
-
- NSLOG(netsurf, INFO, "Queue ring is now %d elements.", all_queued);
-#endif
+ NSLOG(fetch, DEBUG, "Fetch ring is now %d elements.", all_active);
+ NSLOG(fetch, DEBUG, "Queue ring is now %d elements.", all_queued);
}
/* exported interface documented in content/fetch.h */
void fetch_set_http_code(struct fetch *fetch, long http_code)
{
- FETCH_LOG("Setting HTTP code to %ld", http_code);
+ NSLOG(fetch, DEBUG, "Setting HTTP code to %ld", http_code);
fetch->http_code = http_code;
}
diff --git a/utils/log.c b/utils/log.c
index 834a3e9..db90cbf 100644
--- a/utils/log.c
+++ b/utils/log.c
@@ -93,6 +93,7 @@ static const char *nslog_gettime(void)
NSLOG_DEFINE_CATEGORY(netsurf, "NetSurf default logging");
NSLOG_DEFINE_CATEGORY(llcache, "Low level cache");
+NSLOG_DEFINE_CATEGORY(fetch, "objet fetching");
static void
netsurf_render_log(void *_ctx,
diff --git a/utils/log.h b/utils/log.h
index 50ceac0..eee4692 100644
--- a/utils/log.h
+++ b/utils/log.h
@@ -58,6 +58,7 @@ extern nserror nslog_init(nslog_ensure_t *ensure, int *pargc,
char **argv);
NSLOG_DECLARE_CATEGORY(netsurf);
NSLOG_DECLARE_CATEGORY(llcache);
+NSLOG_DECLARE_CATEGORY(fetch);
#else /* WITH_NSLOG */
-----------------------------------------------------------------------
Summary of changes:
content/fetch.c | 80 ++++++++++++++++++++--------------------
frontends/beos/fetch_rsrc.cpp | 8 ++--
frontends/beos/gui.cpp | 4 +-
frontends/beos/plotters.cpp | 4 +-
frontends/beos/scaffolding.cpp | 11 ++++--
frontends/beos/schedule.cpp | 10 +++--
frontends/beos/throbber.cpp | 16 +++++---
frontends/beos/window.cpp | 7 ++--
utils/log.c | 1 +
utils/log.h | 1 +
10 files changed, 79 insertions(+), 63 deletions(-)
diff --git a/content/fetch.c b/content/fetch.c
index fc72d13..7665029 100644
--- a/content/fetch.c
+++ b/content/fetch.c
@@ -60,16 +60,6 @@
#include "javascript/fetcher.h"
#include "content/urldb.h"
-/* Define this to turn on verbose fetch logging */
-#undef DEBUG_FETCH_VERBOSE
-
-/** Verbose fetcher logging */
-#ifdef DEBUG_FETCH_VERBOSE
-#define FETCH_LOG(x...) LOG(x...)
-#else
-#define FETCH_LOG(x...)
-#endif
-
/** The maximum number of fetchers that can be added */
#define MAX_FETCHERS 10
@@ -158,8 +148,10 @@ static int get_fetcher_for_scheme(lwc_string *scheme)
static bool fetch_dispatch_job(struct fetch *fetch)
{
RING_REMOVE(queue_ring, fetch);
- FETCH_LOG("Attempting to start fetch %p, fetcher %p, url %s", fetch,
- fetch->fetcher_handle, nsurl_access(fetch->url));
+ NSLOG(fetch, DEBUG,
+ "Attempting to start fetch %p, fetcher %p, url %s", fetch,
+ fetch->fetcher_handle,
+ nsurl_access(fetch->url));
if (!fetchers[fetch->fetcherd].ops.start(fetch->fetcher_handle)) {
RING_INSERT(queue_ring, fetch); /* Put it back on the end of
the queue */
@@ -210,14 +202,13 @@ static bool fetch_choose_and_dispatch(void)
static void dump_rings(void)
{
-#ifdef DEBUG_FETCH_VERBOSE
struct fetch *q;
struct fetch *f;
q = queue_ring;
if (q) {
do {
- NSLOG(netsurf, INFO, "queue_ring: %s",
+ NSLOG(fetch, DEBUG, "queue_ring: %s",
nsurl_access(q->url));
q = q->r_next;
} while (q != queue_ring);
@@ -225,12 +216,11 @@ static void dump_rings(void)
f = fetch_ring;
if (f) {
do {
- NSLOG(netsurf, INFO, "fetch_ring: %s",
+ NSLOG(fetch, DEBUG, "fetch_ring: %s",
nsurl_access(f->url));
f = f->r_next;
} while (f != fetch_ring);
}
-#endif
}
/**
@@ -246,7 +236,10 @@ static bool fetch_dispatch_jobs(void)
RING_GETSIZE(struct fetch, queue_ring, all_queued);
RING_GETSIZE(struct fetch, fetch_ring, all_active);
- FETCH_LOG("queue_ring %i, fetch_ring %i", all_queued, all_active);
+ NSLOG(fetch, DEBUG,
+ "queue_ring %i, fetch_ring %i",
+ all_queued,
+ all_active);
dump_rings();
while ((all_queued != 0) &&
@@ -254,12 +247,14 @@ static bool fetch_dispatch_jobs(void)
fetch_choose_and_dispatch()) {
all_queued--;
all_active++;
- FETCH_LOG("%d queued, %d fetching",
- all_queued, all_active);
+ NSLOG(fetch, DEBUG,
+ "%d queued, %d fetching",
+ all_queued,
+ all_active);
}
- FETCH_LOG("Fetch ring is now %d elements.", all_active);
- FETCH_LOG("Queue ring is now %d elements.", all_queued);
+ NSLOG(fetch, DEBUG, "Fetch ring is now %d elements.", all_active);
+ NSLOG(fetch, DEBUG, "Queue ring is now %d elements.", all_queued);
return (all_active > 0);
}
@@ -269,7 +264,7 @@ static void fetcher_poll(void *unused)
int fetcherd;
if (fetch_dispatch_jobs()) {
- FETCH_LOG("Polling fetchers");
+ NSLOG(fetch, DEBUG, "Polling fetchers");
for (fetcherd = 0; fetcherd < MAX_FETCHERS; fetcherd++) {
if (fetchers[fetcherd].refcount > 0) {
/* fetcher present */
@@ -343,7 +338,7 @@ void fetcher_quit(void)
* the reference count to allow the fetcher to
* be stopped.
*/
- NSLOG(netsurf, INFO,
+ NSLOG(fetch, INFO,
"Fetcher for scheme %s still has %d active users
at quit.",
lwc_string_data(fetchers[fetcherd].scheme),
fetchers[fetcherd].refcount);
@@ -396,12 +391,12 @@ fetch_fdset(fd_set *read_fd_set,
int fetcherd; /* fetcher index */
if (!fetch_dispatch_jobs()) {
- FETCH_LOG("No jobs");
+ NSLOG(fetch, DEBUG, "No jobs");
*maxfd_out = -1;
return NSERROR_OK;
}
- FETCH_LOG("Polling fetchers");
+ NSLOG(fetch, DEBUG, "Polling fetchers");
for (fetcherd = 0; fetcherd < MAX_FETCHERS; fetcherd++) {
if (fetchers[fetcherd].refcount > 0) {
@@ -484,7 +479,7 @@ fetch_start(nsurl *url,
return NSERROR_NO_FETCH_HANDLER;
}
- FETCH_LOG("fetch %p, url '%s'", fetch, nsurl_access(url));
+ NSLOG(fetch, DEBUG, "fetch %p, url '%s'", fetch, nsurl_access(url));
/* construct a new fetch structure */
fetch->callback = callback;
@@ -576,7 +571,7 @@ fetch_start(nsurl *url,
/* Ask the queue to run. */
if (fetch_dispatch_jobs()) {
- FETCH_LOG("scheduling poll");
+ NSLOG(fetch, DEBUG, "scheduling poll");
/* schedule active fetchers to run again in 10ms */
guit->misc->schedule(10, fetcher_poll, NULL);
}
@@ -589,7 +584,8 @@ fetch_start(nsurl *url,
void fetch_abort(struct fetch *f)
{
assert(f);
- FETCH_LOG("fetch %p, fetcher %p, url '%s'", f, f->fetcher_handle,
+ NSLOG(fetch, DEBUG,
+ "fetch %p, fetcher %p, url '%s'", f, f->fetcher_handle,
nsurl_access(f->url));
fetchers[f->fetcherd].ops.abort(f->fetcher_handle);
}
@@ -597,7 +593,10 @@ void fetch_abort(struct fetch *f)
/* exported interface documented in content/fetch.h */
void fetch_free(struct fetch *f)
{
- FETCH_LOG("Freeing fetch %p, fetcher %p", f, f->fetcher_handle);
+ NSLOG(fetch, DEBUG,
+ "Freeing fetch %p, fetcher %p",
+ f,
+ f->fetcher_handle);
fetchers[f->fetcherd].ops.free(f->fetcher_handle);
@@ -723,7 +722,8 @@ void fetch_multipart_data_destroy(struct
fetch_multipart_data *list)
free(list->name);
free(list->value);
if (list->file) {
- FETCH_LOG("Freeing rawfile: %s", list->rawfile);
+ NSLOG(fetch, DEBUG,
+ "Freeing rawfile: %s", list->rawfile);
free(list->rawfile);
}
free(list);
@@ -741,8 +741,13 @@ fetch_send_callback(const fetch_msg *msg, struct fetch
*fetch)
/* exported interface documented in content/fetch.h */
void fetch_remove_from_queues(struct fetch *fetch)
{
- FETCH_LOG("Fetch %p, fetcher %p can be freed",
- fetch, fetch->fetcher_handle);
+ int all_active;
+ int all_queued;
+
+ NSLOG(fetch, DEBUG,
+ "Fetch %p, fetcher %p can be freed",
+ fetch,
+ fetch->fetcher_handle);
/* Go ahead and free the fetch properly now */
if (fetch->fetch_is_active) {
@@ -751,24 +756,19 @@ void fetch_remove_from_queues(struct fetch *fetch)
RING_REMOVE(queue_ring, fetch);
}
-#ifdef DEBUG_FETCH_VERBOSE
- int all_active;
- int all_queued;
RING_GETSIZE(struct fetch, fetch_ring, all_active);
RING_GETSIZE(struct fetch, queue_ring, all_queued);
- NSLOG(netsurf, INFO, "Fetch ring is now %d elements.", all_active);
-
- NSLOG(netsurf, INFO, "Queue ring is now %d elements.", all_queued);
-#endif
+ NSLOG(fetch, DEBUG, "Fetch ring is now %d elements.", all_active);
+ NSLOG(fetch, DEBUG, "Queue ring is now %d elements.", all_queued);
}
/* exported interface documented in content/fetch.h */
void fetch_set_http_code(struct fetch *fetch, long http_code)
{
- FETCH_LOG("Setting HTTP code to %ld", http_code);
+ NSLOG(fetch, DEBUG, "Setting HTTP code to %ld", http_code);
fetch->http_code = http_code;
}
diff --git a/frontends/beos/fetch_rsrc.cpp b/frontends/beos/fetch_rsrc.cpp
index 3adf4e5..ae36483 100644
--- a/frontends/beos/fetch_rsrc.cpp
+++ b/frontends/beos/fetch_rsrc.cpp
@@ -164,7 +164,7 @@ static bool fetch_rsrc_process(struct fetch_rsrc_context *c)
* rsrc://[TYPE][@NUM]/name[,mime]
*/
- LOG("*** Processing %s", c->url);
+ NSLOG(netsurf, INFO, "*** Processing %s", c->url);
if (strlen(c->url) < 7) {
/* 7 is the minimum possible length (rsrc://) */
@@ -201,11 +201,13 @@ static bool fetch_rsrc_process(struct fetch_rsrc_context
*c)
uint8 c1, c2, c3, c4;
if (sscanf(params, "%c%c%c%c", &c1, &c2, &c3, &c4) > 3) {
type = c1 << 24 | c2 << 16 | c3 << 8 | c4;
- LOG("fetch_rsrc: type:%4.4s\n", (char *)&type);
+ NSLOG(netsurf, INFO, "fetch_rsrc: type:%4.4s\n",
+ (char *)&type);
}
}
- LOG("fetch_rsrc: 0x%08lx, %ld, '%s'\n", type, id, c->name);
+ NSLOG(netsurf, INFO, "fetch_rsrc: 0x%08lx, %ld, '%s'\n", type, id,
+ c->name);
bool found;
if (id)
diff --git a/frontends/beos/gui.cpp b/frontends/beos/gui.cpp
index 6d0cce0..f2c9917 100644
--- a/frontends/beos/gui.cpp
+++ b/frontends/beos/gui.cpp
@@ -112,7 +112,7 @@ static int sEventPipe[2];
/* exported function defined in beos/gui.h */
nserror beos_warn_user(const char *warning, const char *detail)
{
- LOG("warn_user: %s (%s)", warning, detail);
+ NSLOG(netsurf, INFO, "warn_user: %s (%s)", warning, detail);
BAlert *alert;
BString text(warning);
if (detail)
@@ -388,7 +388,7 @@ static nsurl *gui_get_resource_url(const char *path)
path = "favicon.png";
u << path;
- LOG("(%s) -> '%s'\n", path, u.String());
+ NSLOG(netsurf, INFO, "(%s) -> '%s'\n", path, u.String());
nsurl_create(u.String(), &url);
return url;
}
diff --git a/frontends/beos/plotters.cpp b/frontends/beos/plotters.cpp
index c77e635..c4903e0 100644
--- a/frontends/beos/plotters.cpp
+++ b/frontends/beos/plotters.cpp
@@ -538,7 +538,7 @@ nsbeos_plot_path(const struct redraw_context *ctx,
}
if (p[0] != PLOTTER_PATH_MOVE) {
- LOG("path doesn't start with a move");
+ NSLOG(netsurf, INFO, "path doesn't start with a move");
return NSERROR_INVALID;
}
@@ -563,7 +563,7 @@ nsbeos_plot_path(const struct redraw_context *ctx,
shape.BezierTo(pt);
i += 7;
} else {
- LOG("bad path command %f", p[i]);
+ NSLOG(netsurf, INFO, "bad path command %f", p[i]);
return NSERROR_INVALID;
}
}
diff --git a/frontends/beos/scaffolding.cpp b/frontends/beos/scaffolding.cpp
index 426afff..e6fb6e5 100644
--- a/frontends/beos/scaffolding.cpp
+++ b/frontends/beos/scaffolding.cpp
@@ -854,7 +854,9 @@ void nsbeos_scaffolding_dispatch_event(nsbeos_scaffolding
*scaffold, BMessage *m
bw = nsbeos_get_browser_for_gui(scaffold->top_level);
bool reloadAll = false;
- LOG("nsbeos_scaffolding_dispatch_event() what = 0x%08lx",
message->what);
+ NSLOG(netsurf, INFO,
+ "nsbeos_scaffolding_dispatch_event() what = 0x%08lx",
+ message->what);
switch (message->what) {
case B_QUIT_REQUESTED:
nsbeos_scaffolding_destroy(scaffold);
@@ -997,7 +999,7 @@ void nsbeos_scaffolding_dispatch_event(nsbeos_scaffolding
*scaffold, BMessage *m
browser_window_key_press(bw, NS_KEY_PASTE);
break;
case B_SELECT_ALL:
- LOG("Selecting all text");
+ NSLOG(netsurf, INFO, "Selecting all text");
browser_window_key_press(bw, NS_KEY_SELECT_ALL);
break;
case B_NETPOSITIVE_BACK:
@@ -1445,7 +1447,7 @@ static void recursively_set_menu_items_target(BMenu
*menu, BHandler *handler)
void nsbeos_attach_toplevel_view(nsbeos_scaffolding *g, BView *view)
{
- LOG("Attaching view to scaffolding %p", g);
+ NSLOG(netsurf, INFO, "Attaching view to scaffolding %p", g);
// this is a replicant,... and it went bad
if (!g->window) {
@@ -1723,7 +1725,8 @@ nsbeos_scaffolding *nsbeos_new_scaffolding(struct
gui_window *toplevel)
{
struct beos_scaffolding *g = (struct beos_scaffolding
*)malloc(sizeof(*g));
- LOG("Constructing a scaffold of %p for gui_window %p", g, toplevel);
+ NSLOG(netsurf, INFO,
+ "Constructing a scaffold of %p for gui_window %p", g, toplevel);
g->top_level = toplevel;
g->being_destroyed = 0;
diff --git a/frontends/beos/schedule.cpp b/frontends/beos/schedule.cpp
index 92816c5..552a7cd 100644
--- a/frontends/beos/schedule.cpp
+++ b/frontends/beos/schedule.cpp
@@ -83,7 +83,7 @@ schedule_remove(void (*callback)(void *p), void *p)
nserror beos_schedule(int t, void (*callback)(void *p), void *p)
{
- LOG("t:%d cb:%p p:%p", t, cb->callback, cb->context);
+ NSLOG(netsurf, INFO, "t:%d cb:%p p:%p", t, cb->callback, cb->context);
if (callbacks == NULL) {
callbacks = new BList;
@@ -113,7 +113,7 @@ nserror beos_schedule(int t, void (*callback)(void *p),
void *p)
bool
schedule_run(void)
{
- LOG("schedule_run()");
+ NSLOG(netsurf, INFO, "schedule_run()");
earliest_callback_timeout = B_INFINITE_TIMEOUT;
if (callbacks == NULL)
@@ -122,7 +122,8 @@ schedule_run(void)
bigtime_t now = system_time();
int32 i;
- LOG("Checking %ld callbacks to for deadline.", this_run->CountItems());
+ NSLOG(netsurf, INFO, "Checking %ld callbacks to for deadline.",
+ this_run->CountItems());
/* Run all the callbacks which made it this far. */
for (i = 0; i < callbacks->CountItems(); ) {
@@ -134,7 +135,8 @@ schedule_run(void)
i++;
continue;
}
- LOG("Running callbacks %p(%p).", cb->callback, cb->context);
+ NSLOG(netsurf, INFO, "Running callbacks %p(%p).",
+ cb->callback, cb->context);
if (!cb->callback_killed)
cb->callback(cb->context);
callbacks->RemoveItem(cb);
diff --git a/frontends/beos/throbber.cpp b/frontends/beos/throbber.cpp
index fe40b3e..27ed423 100644
--- a/frontends/beos/throbber.cpp
+++ b/frontends/beos/throbber.cpp
@@ -50,14 +50,17 @@ bool nsbeos_throbber_initialise_from_png(const int frames,
...)
if (frames < 2) {
/* we need at least two frames - one for idle, one for active */
- LOG("Insufficent number of frames in throbber animation!");
- LOG("(called with %d frames, where 2 is a minimum.)", frames);
+ NSLOG(netsurf, INFO,
+ "Insufficent number of frames in throbber animation!");
+ NSLOG(netsurf, INFO,
+ "(called with %d frames, where 2 is a minimum.)",
+ frames);
return false;
}
BResources *res = get_app_resources();
if (res == NULL) {
- LOG("Can't find resources for throbber!");
+ NSLOG(netsurf, INFO, "Can't find resources for throbber!");
return false;
}
@@ -74,14 +77,17 @@ bool nsbeos_throbber_initialise_from_png(const int frames,
...)
data = res->LoadResource('data', fn, &size);
throb->framedata[i] = NULL;
if (!data) {
- LOG("Error when loading resource %s", fn);
+ NSLOG(netsurf, INFO, "Error when loading resource %s",
+ fn);
errors_when_loading = true;
continue;
}
BMemoryIO mem(data, size);
throb->framedata[i] = BTranslationUtils::GetBitmap(&mem);
if (throb->framedata[i] == NULL) {
- LOG("Error when loading %s: GetBitmap() returned NULL",
fn);
+ NSLOG(netsurf, INFO,
+ "Error when loading %s: GetBitmap() returned
NULL",
+ fn);
errors_when_loading = true;
}
}
diff --git a/frontends/beos/window.cpp b/frontends/beos/window.cpp
index 7d59b36..c6e2aad 100644
--- a/frontends/beos/window.cpp
+++ b/frontends/beos/window.cpp
@@ -354,7 +354,8 @@ static struct gui_window *gui_window_create(struct
browser_window *bw,
return 0;
}
- LOG("Creating gui window %p for browser window %p", g, bw);
+ NSLOG(netsurf, INFO, "Creating gui window %p for browser window %p",
+ g, bw);
g->bw = bw;
g->mouse.state = 0;
@@ -933,10 +934,10 @@ static void gui_window_destroy(struct gui_window *g)
g->next->prev = g->prev;
- LOG("Destroying gui_window %p", g);
+ NSLOG(netsurf, INFO, "Destroying gui_window %p", g);
assert(g != NULL);
assert(g->bw != NULL);
- LOG(" Scaffolding: %p", g->scaffold);
+ NSLOG(netsurf, INFO, " Scaffolding: %p", g->scaffold);
if (g->view == NULL)
return;
diff --git a/utils/log.c b/utils/log.c
index 834a3e9..db90cbf 100644
--- a/utils/log.c
+++ b/utils/log.c
@@ -93,6 +93,7 @@ static const char *nslog_gettime(void)
NSLOG_DEFINE_CATEGORY(netsurf, "NetSurf default logging");
NSLOG_DEFINE_CATEGORY(llcache, "Low level cache");
+NSLOG_DEFINE_CATEGORY(fetch, "objet fetching");
static void
netsurf_render_log(void *_ctx,
diff --git a/utils/log.h b/utils/log.h
index 50ceac0..eee4692 100644
--- a/utils/log.h
+++ b/utils/log.h
@@ -58,6 +58,7 @@ extern nserror nslog_init(nslog_ensure_t *ensure, int *pargc,
char **argv);
NSLOG_DECLARE_CATEGORY(netsurf);
NSLOG_DECLARE_CATEGORY(llcache);
+NSLOG_DECLARE_CATEGORY(fetch);
#else /* WITH_NSLOG */
--
NetSurf Browser
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org