Content: Log URLs with nsurl_access_log().

This reduces the log file size for startup and a single visit
to https://www.bbc.co.uk/news from 266133 to 178777 bytes,
by not dumping big data URLs over and over into the log.
This commit is contained in:
Michael Drake 2018-08-09 16:31:16 +01:00
parent fa546661ad
commit 9fecbc6554

View File

@ -74,7 +74,7 @@ nserror content__init(struct content *c, const content_handler *handler,
nserror error; nserror error;
NSLOG(netsurf, INFO, "url "URL_FMT_SPC" -> %p", NSLOG(netsurf, INFO, "url "URL_FMT_SPC" -> %p",
nsurl_access(llcache_handle_get_url(llcache)), c); nsurl_access_log(llcache_handle_get_url(llcache)), c);
user_sentinel = calloc(1, sizeof(struct content_user)); user_sentinel = calloc(1, sizeof(struct content_user));
if (user_sentinel == NULL) { if (user_sentinel == NULL) {
@ -274,7 +274,7 @@ void content_convert(struct content *c)
return; return;
NSLOG(netsurf, INFO, "content "URL_FMT_SPC" (%p)", NSLOG(netsurf, INFO, "content "URL_FMT_SPC" (%p)",
nsurl_access(llcache_handle_get_url(c->llcache)), c); nsurl_access_log(llcache_handle_get_url(c->llcache)), c);
if (c->handler->data_complete != NULL) { if (c->handler->data_complete != NULL) {
c->locked = true; c->locked = true;
@ -379,7 +379,7 @@ void content_destroy(struct content *c)
assert(c); assert(c);
NSLOG(netsurf, INFO, "content %p %s", c, NSLOG(netsurf, INFO, "content %p %s", c,
nsurl_access(llcache_handle_get_url(c->llcache))); nsurl_access_log(llcache_handle_get_url(c->llcache)));
assert(c->locked == false); assert(c->locked == false);
if (c->handler->destroy != NULL) if (c->handler->destroy != NULL)
@ -658,8 +658,8 @@ bool content_add_user(
struct content_user *user; struct content_user *user;
NSLOG(netsurf, INFO, "content "URL_FMT_SPC" (%p), user %p %p", NSLOG(netsurf, INFO, "content "URL_FMT_SPC" (%p), user %p %p",
nsurl_access(llcache_handle_get_url(c->llcache)), c, callback, nsurl_access_log(llcache_handle_get_url(c->llcache)),
pw); c, callback, pw);
user = malloc(sizeof(struct content_user)); user = malloc(sizeof(struct content_user));
if (!user) if (!user)
return false; return false;
@ -693,8 +693,8 @@ void content_remove_user(
{ {
struct content_user *user, *next; struct content_user *user, *next;
NSLOG(netsurf, INFO, "content "URL_FMT_SPC" (%p), user %p %p", NSLOG(netsurf, INFO, "content "URL_FMT_SPC" (%p), user %p %p",
nsurl_access(llcache_handle_get_url(c->llcache)), c, callback, nsurl_access_log(llcache_handle_get_url(c->llcache)),
pw); c, callback, pw);
/* user_list starts with a sentinel */ /* user_list starts with a sentinel */
for (user = c->user_list; user->next != 0 && for (user = c->user_list; user->next != 0 &&
@ -816,7 +816,7 @@ void content_open(hlcache_handle *h, struct browser_window *bw,
struct content *c = hlcache_handle_get_content(h); struct content *c = hlcache_handle_get_content(h);
assert(c != 0); assert(c != 0);
NSLOG(netsurf, INFO, "content %p %s", c, NSLOG(netsurf, INFO, "content %p %s", c,
nsurl_access(llcache_handle_get_url(c->llcache))); nsurl_access_log(llcache_handle_get_url(c->llcache)));
if (c->handler->open != NULL) if (c->handler->open != NULL)
c->handler->open(c, bw, page, params); c->handler->open(c, bw, page, params);
} }
@ -833,7 +833,7 @@ void content_close(hlcache_handle *h)
struct content *c = hlcache_handle_get_content(h); struct content *c = hlcache_handle_get_content(h);
assert(c != 0); assert(c != 0);
NSLOG(netsurf, INFO, "content %p %s", c, NSLOG(netsurf, INFO, "content %p %s", c,
nsurl_access(llcache_handle_get_url(c->llcache))); nsurl_access_log(llcache_handle_get_url(c->llcache)));
if (c->handler->close != NULL) if (c->handler->close != NULL)
c->handler->close(c); c->handler->close(c);
} }