Reduce the amount of data the twitter plugin logs into the Error Console

RESOLVED FIXED in 1.0

Status

Chat Core
Debug
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: florian, Assigned: clokep)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [0.3-blocking-final])

Attachments

(1 attachment, 2 obsolete attachments)

(Reporter)

Description

4 years ago
*** Original post on bio 681 at 2011-02-04 13:20:00 UTC ***

Currently all the data from the twitter plugin (requests sent, received response) is logged. That's sometimes huge messages in the error console, and they are not really human readable.

The messages come from the HTTP request implementation in jsProtoHelper, that uses the LOG function.

I think that function should use a preference to determine what to do with logged debug data.
(Reporter)

Updated

4 years ago
Blocks: 954035
(Reporter)

Updated

4 years ago
Whiteboard: [0.3-blocking]
(Assignee)

Comment 1

4 years ago
*** Original post on bio 681 at 2011-02-16 15:19:26 UTC ***

This would be useful to all protocols to make the LOG command be able to handle debug levels, etc.

Summary of ideas from IRC:
All js protocol plugins can call LOG with some debug junk, and preferences to select which junk should appear (all, none, only important messages, only one protocol, ...) 

flo suggested: maybe just put the LOG function of jsProtoHelper into an Utils exported object, and then at the top of each protocol plugin code: const LOG = Utils.LOG.bind(null, "IRC");
(Reporter)

Updated

4 years ago
Whiteboard: [0.3-blocking] → [0.3-blocking-final]
(Assignee)

Comment 2

4 years ago
*** Original post on bio 681 at 2011-06-07 23:01:22 UTC ***

The plan is to make a simple LOG command that checks the purple logging pref: http://lxr.instantbird.org/instantbird/source/instantbird/app/profile/all-instantbird.js#293
Assignee: nobody → clokep
Status: NEW → ASSIGNED
(Assignee)

Comment 3

4 years ago
Created attachment 8352451 [details] [diff] [review]
Patch

*** Original post on bio 681 as attmnt 709 at 2011-06-14 23:35:00 UTC ***

This adds a DEBUG, LOG, WARN and ERROR statement that abide by the purple.debug.loglevel preference.

WARN and ERROR include the line number and file.
Attachment #8352451 - Flags: review?(florian)
(Assignee)

Comment 4

4 years ago
*** Original post on bio 681 at 2011-06-15 02:10:08 UTC ***

Comment on attachment 8352451 [details] [diff] [review] (bio-attmnt 709)
Patch

>+  // Log a warning or error with a line number and file.
>+  // Take the caller of this function and extract the line number and file.
>+  let matches = /^(.+)@(.+):(\d+)$/.exec((new Error).stack.split("\n")[2]);

Also, I just wanted to comment that as messed up as this looks...as far as I can tell this is the "correct" way to get a decent stack trace in JavaScript. Let me know if the comment needs to be expanded.
(Reporter)

Comment 5

4 years ago
Created attachment 8352453 [details] [diff] [review]
Patch v2

*** Original post on bio 681 as attmnt 711 at 2011-06-15 13:18:00 UTC ***

After some discussion on IRC and several iterations, I think this is what we agreed on.
Attachment #8352453 - Flags: review?(clokep)
(Reporter)

Comment 6

4 years ago
Comment on attachment 8352451 [details] [diff] [review]
Patch

*** Original change on bio 681 attmnt 709 at 2011-06-15 13:18:36 UTC was without comment, so any subsequent comment numbers will be shifted ***
Attachment #8352451 - Attachment is obsolete: true
Attachment #8352451 - Flags: review?(florian)
(Reporter)

Comment 7

4 years ago
Created attachment 8352454 [details] [diff] [review]
Patch v2

*** Original post on bio 681 as attmnt 712 at 2011-06-15 13:21:00 UTC ***

Let's attach the right patch this time :)
Attachment #8352454 - Flags: review?(clokep)
(Reporter)

Comment 8

4 years ago
Comment on attachment 8352453 [details] [diff] [review]
Patch v2

*** Original change on bio 681 attmnt 711 at 2011-06-15 13:21:06 UTC was without comment, so any subsequent comment numbers will be shifted ***
Attachment #8352453 - Attachment is obsolete: true
Attachment #8352453 - Flags: review?(clokep)
(Assignee)

Comment 9

4 years ago
Comment on attachment 8352454 [details] [diff] [review]
Patch v2

*** Original change on bio 681 attmnt 712 at 2011-06-15 13:33:22 UTC ***

Looks good! I like this a lot better than what I had.

Removing the "Error: " is up to you, but it's probably not necessary anymore. Can't wait to convert my JS-IRC to use this! Thanks for cleaning it up.
Attachment #8352454 - Flags: review?(clokep) → review+
(Reporter)

Comment 10

4 years ago
*** Original post on bio 681 at 2011-06-15 18:00:49 UTC ***

https://hg.instantbird.org/instantbird/rev/f6ae36370e55
Status: ASSIGNED → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 1.0
You need to log in before you can comment on or make changes to this bug.