Skip to content

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

@babygiraffe

Description

@babygiraffe

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
    

    },
    };

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions