How does Vala support the C language's __function__ __file__ __line__ macros? -
i need add log informations souce file name, function name,
line number etc...
i have check official docs, not found...
so, how ?
this done via glib logging.
for example try vala application:
int main (string[] args) { // info () not shown default, set g_messages_debug=all in shell see them info ("hello world"); warning ("hello world"); //assert_true (false); // error () terminates program error ("hello world"); return 0; }
the output is:
$ g_messages_debug=all src/glib_logging_test ** info: glib_logging_test.vala:4: hello world ** (process:10129): warning **: glib_logging_test.vala:5: hello world ** (process:10129): error **: glib_logging_test.vala:9: hello world trace/breakpoint ausgelöst
you can set g_debug
in addition g_messages_debug
, see running glib applications.
you can install a custom handler log.set_handler ()
well.
there log.file
, log.line
, log.method
raw information equivalent c macros.
Comments
Post a Comment