Closed Bug 708498 Opened 8 years ago Closed 8 years ago

TPS logging improvements

Categories

(Firefox :: Sync, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla11

People

(Reporter: gps, Unassigned)

Details

(Whiteboard: [fixed in services])

Attachments

(2 files)

TPS logging could be better.

The attached patch makes the following changes:

1) Fixes a bug where the printed day of the month was off by 1
2) Adds an AssertFalse method
3) Rewrite AssertTrue using more readable flow
4) Print stack traces after JS exceptions

Altogether, they make for a more pleasant TPS debugging experience!
Attachment #579919 - Flags: review?(rnewman)
Comment on attachment 579919 [details] [diff] [review]
TPS logging enhancements, v1

Review of attachment 579919 [details] [diff] [review]:
-----------------------------------------------------------------

::: services/sync/tps/extensions/tps/modules/logger.jsm
@@ +106,5 @@
>      }
> +
> +    let message = msg;
> +    if (showPotentialError && this._potentialError) {
> +      message += "; " + this._potentialError;

Strings are immutable in JS. You can use msg directly.

@@ -125,5 @@
>      else {
>        var now = new Date()
>        this.write(now.getFullYear() + "-" + (now.getMonth() < 9 ? '0' : '') +
>            (now.getMonth() + 1) + "-" +
> -          (now.getDate() < 9 ? '0' : '') + (now.getDate() + 1) + " " +

Wow.
Attachment #579919 - Flags: review?(rnewman) → review+
This is a follow-up to add milliseconds to the printed date string. I also cleaned up the formatting code to make it more readable. JavaScript: y u no strftime()?
Attachment #580223 - Flags: review?(rnewman)
Comment on attachment 580223 [details] [diff] [review]
Render milliseconds, cleanup

Review of attachment 580223 [details] [diff] [review]:
-----------------------------------------------------------------

::: services/sync/tps/extensions/tps/modules/logger.jsm
@@ +153,5 @@
> +      let day     = pad(now.getDate(), 2);
> +      let hour    = pad(now.getHours(), 2);
> +      let minutes = pad(now.getMinutes(), 2);
> +      let seconds = pad(now.getSeconds(), 2);
> +      let ms      = pad(now.getMilliseconds(), 3);

Align the second arguments to pad, please.
Attachment #580223 - Flags: review?(rnewman) → review+
Pushed to s-c: https://hg.mozilla.org/services/services-central/rev/6bc741986c80
Whiteboard: [fixed in services]
Pushed to m-c: https://hg.mozilla.org/mozilla-central/rev/ea538df967d5
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla11
Component: Firefox Sync: Backend → Sync
Product: Cloud Services → Firefox
You need to log in before you can comment on or make changes to this bug.