Skip to content

Loading…

Bug 850296 - Connect our console module to the devtool console #850

Closed
wants to merge 1 commit into from

2 participants

@ochameau
Mozilla member

WIP, to be tuned and tested against global browser console

https://bugzilla.mozilla.org/show_bug.cgi?id=850296

@jsantell
Mozilla member

@ochameau can this be closed with the merging of PR 1106?

@ochameau
Mozilla member

sure

@ochameau ochameau closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Showing with 13 additions and 0 deletions.
  1. +13 −0 lib/sdk/console/plain-text.js
View
13 lib/sdk/console/plain-text.js
@@ -14,6 +14,8 @@ const traceback = require("./traceback")
const prefs = require("../preferences/service");
const { merge } = require("../util/object");
const { curry } = require("../lang/functional");
+const obsService = Cc["@mozilla.org/observer-service;1"].
+ getService(Ci.nsIObserverService);
const LEVELS = {
"all": Number.MIN_VALUE,
@@ -66,6 +68,17 @@ function message(print, level) {
let args = Array.slice(arguments, 2);
print(level + ": " + self.name + ": " + stringifyArgs(args) + "\n", level);
+
+ let consoleEvent = {
+ ID: self.id,
+ level: level,
+ filename: "?",
+ lineNumber: 1,
+ functionName: "?",
+ arguments: args
+ };
+ consoleEvent.wrappedJSObject = consoleEvent;
+ obsService.notifyObservers(consoleEvent, "jetpack-api-log-event", -1);
}
function errorMessage(print, e) {
Something went wrong with that request. Please try again.