← Back to team overview

elementary-dev-community team mailing list archive

Re: Granite Logger

 

I suppose notification() and g_message() doesn't print exactly the same thing, there is several log level:

        DEBUG,
        INFO,
        NOTIFY,
        WARN,
        ERROR,
        FATAL,

So I suppose INFO = g_message.

There is a default display level for the Logger (Granite.Services.Logger.DIsplayLevel), by default it is set to LogLevel.WARN, so, you have to change it if you want to print debug informations.

Lucas

On 08/14/2011 06:44 PM, Avi Romanoff wrote:
Hey,

In that case, why should logger.notification() exist when I should just be able to use g_message()?

But actually, message(), logger.notification(), and debug() do *not* print to terminal. I tested all of the logging convenience functions I could find and threw this into my code:

        var logger = new Granite.Services.Logger ();
        logger.initialize(APP_TITLE);
        logger.notification("logger.notify();");
        warning("warning();");
        debug("debug();");
        critical("crticial();");
        message("message();");

Which when run results in:

aroman@crackedpipes:~/elementary/switchboard/build$ ./switchboard
[L_WARN 12:38:53.392668] [switchboard-app:354] warning();
[L_FATAL 12:38:53.392936] [switchboard-app:356] crticial();
[L_FATAL 12:38:53.393048] Switchboard will not function properly.
aroman@crackedpipes:~/elementary/switchboard/build$ ^C

So only 2 of the 5 logging functions, including the one in Logger itself, didn't work.

Am I doing something wrong, or is this a bug?


On Sun, Aug 14, 2011 at 5:27 AM, Lucas Baudin <xapantu@xxxxxxxxx <mailto:xapantu@xxxxxxxxx>> wrote:

    Hi,

    I don't have the time to write a long mail atm, but in fact, you
    must call g_debug (or debug() in vala), g_warning, g_critical,
    etc... to log any informations using the Granite logger. It will
    just replace the default glib formatter, but you must use the same
    functions.

    Lucas


    On 08/14/2011 08:26 AM, Avi Romanoff wrote:
    Hi,

    I am in the process of giving Switchboard as much Granite love as
    I can before the imminent 1.0 launch. I believe the way logging
    works in Granite right now is pretty broken.

    First off, the only logging function Logger actually provides is
    notification(), which does not even appear to print any message
    in my test. Obviously it should work, and I'll file a bug, but
    what about other log levels? Surely it would make just as much
    sense to have convenience functions for critical/fatal and
    debugging errors as well?

    Additionally it seems to me that Logger being something of a
    singleton makes it massively annoying to log errors in different
    parts of an application, where access to the Logger object might
    not be available. Could/should the logging system
    be re-factored to accommodate this, or am I missing something?

    Avi




    --
    Mailing list: https://launchpad.net/~elementary-dev-community
    <https://launchpad.net/%7Eelementary-dev-community>
    Post to     : elementary-dev-community@xxxxxxxxxxxxxxxxxxx
    <mailto:elementary-dev-community@xxxxxxxxxxxxxxxxxxx>
    Unsubscribe : https://launchpad.net/~elementary-dev-community
    <https://launchpad.net/%7Eelementary-dev-community>
    More help   : https://help.launchpad.net/ListHelp




Follow ups

References