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

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -