Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed consoleExport-0.5b5.xpi so that logging parameters are sent to logging server URL #3

Open
babygiraffe opened this issue Aug 28, 2013 · 0 comments

Comments

@babygiraffe
Copy link

consoleListener.js
Added
var logJSONText = JSON.stringify(object, null);
and
msg: logJSONText,
This sends the logging line with all the parameters in the logging line to the server url.
Previously the logging line came with its text only and without and parameters in the text line.
Can you please make a new improved version of consoleExporter with these changes?
Thanks.
Regards,
Babygiraffe.

/* See license.txt for terms of usage */

FBL.ns(function() { with (FBL) {

// ************************************************************************************************
// Constants

const Cc = Components.classes;
const Ci = Components.interfaces;

// ************************************************************************************************
// Module implementation

/**

  • This object represents Console panel listener that listens for Console panel logs

  • and uses {@link Firebug.ConsoleExport.Uploader} to upload them to a specified server.
    /
    Firebug.ConsoleExport.Listener =
    /
    * @Lends Firebug.ConsoleExport.Listener */
    {
    registered: false,

    register: function()
    {
    if (!this.registered)
    {
    Firebug.Console.addListener(this);
    Firebug.Profiler.addListener(this);
    }
    },

    unregister: function()
    {
    if (this.registered)
    {
    Firebug.Console.removeListener(this);
    Firebug.Profiler.removeListener(this);
    }
    },

    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    // Console listener

    log: function(context, object, className, sourceLink)
    {
    object = unwrapObject(object);
    var logJSONText = JSON.stringify(object, null);
    if (FBTrace.DBG_CONSOLEEXPORT)
    FBTrace.sysout("consoleexport.Console.Listener.log; " +
    className, object);

    try
    {
        Firebug.ConsoleExport.Uploader.send({
            className: className,
            cat: object.category,
            msg: logJSONText,
            href: object.href ? object.href : context.getName(),
            lineNo: object.lineNo,
            source: object.source,
        });
    }
    catch (err)
    {
        if (FBTrace.DBG_CONSOLEEXPORT || FBTrace.DBG_ERRORS)
            FBTrace.sysout("consoleexport.Console.Listener.log; EXCEPTION " + err, err);
    }
    

    },

    logFormatted: function(context, objects, className, sourceLink)
    {
    objects = unwrapObject(objects);
    var logJSONText = JSON.stringify(objects, null);
    if (FBTrace.DBG_CONSOLEEXPORT)
    FBTrace.sysout("consoleexport.Console.Listener.logFormatted; " +
    className, objects[0]);

    Firebug.ConsoleExport.Uploader.send({
        className: className,
        cat: "log",
        msg: logJSONText,
        href: context.getName(),
    });
    

    },

    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    // Firebug Profiler listener

    startProfiling: function(context, title)
    {
    if (FBTrace.DBG_CONSOLEEXPORT)
    FBTrace.sysout("consoleexport.Console.Listener.startProfiling; " + title);

    // TODO: send to the server
    

    },

    stopProfiling: function(context, title, results, canceled)
    {
    if (FBTrace.DBG_CONSOLEEXPORT)
    FBTrace.sysout("consoleexport.Console.Listener.stopProfiling; " + title +
    (canceled ? " (canceled)" : ""), results);

    // TODO: send to the server
    

    },
    };

// ************************************************************************************************
}});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant