Re: [Vala] Remove line numbers from logging



hi.

1. make simple custom function.

// https://bugzilla.gnome.org/show_bug.cgi?id=546043
class Test {
    static int blah(int test) throws GLib.Error {
        if (test > 0)
            throw new GLib.Error(GLib.Quark.from_string("test"), 0,
"test error");
        return 5;
    }

    static void something(int val) {
        log("value: %d".printf(val));
    }

    //static void log(string s, string e) { stdout.printf(@"$s $e"); }
    static void log(string s) { stdout.printf(@"$s\n"); }

    static void main(string[] args) {
        log("aaa");
        try {
            something(blah(-1));
            something(blah(1));
        } catch(GLib.Error err) {
            log("error: %s".printf(err.message));
        }
    }
}

2. implement logger class. https://launchpad.net/plank
i would be happy to be of any help to you.


Ricardo Gladwell <ricardo gladwell    > writes:

Hi Guys

I'm writing some code that uses the GLib log, debug, message etc. static
methods. Is there anyway to disable/remove the pre-pending of file name
and line number to these outputs so that instead of:

[vain] DefaultVainExecution.vala:18: Scanning for projects...

I just print:

[vain] Scanning for projects...

TIA...




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]