Re: [HACKERS] elog with automatic file, line, and function

2001-03-21 Thread Peter Eisentraut
Tom Lane writes: Sure it is, it just requires a marginal increase in ugliness, namely double parentheses: ELOG((level, format, arg1, arg2, ...)) which might work like #define ELOG(ARGS) (elog_setloc(__FILE__, __LINE__), elog ARGS) Would the first function save the data in global

Re: [HACKERS] elog with automatic file, line, and function

2001-03-21 Thread Tom Lane
Peter Eisentraut [EMAIL PROTECTED] writes: Tom Lane writes: #define ELOG(ARGS) (elog_setloc(__FILE__, __LINE__), elog ARGS) Would the first function save the data in global variables? Yes, that's what I was envisioning. Not a super clean solution, but workable, and better than requiring

[HACKERS] elog with automatic file, line, and function

2001-03-19 Thread Peter Eisentraut
It has been brought up that elog should be able to automatically fill in the file, line, and perhaps the function name where it's called, to avoid having to prefix each message with the function name by hand, which is quite ugly. This is doable, but it requires a C preprocessor that can handle

Re: [HACKERS] elog with automatic file, line, and function

2001-03-19 Thread Tom Lane
Peter Eisentraut [EMAIL PROTECTED] writes: It has been brought up that elog should be able to automatically fill in the file, line, and perhaps the function name where it's called, to avoid having to prefix each message with the function name by hand, which is quite ugly. Since these would

Re: [HACKERS] elog with automatic file, line, and function

2001-03-19 Thread Ian Lance Taylor
Tom Lane [EMAIL PROTECTED] writes: Additionally, C99 (and GCC for a while) would allow filling in the function name automatically. We could probably treat the function name as something that's optionally added to the file/line error report info if the compiler supports it. BTW, how

Re: [HACKERS] elog with automatic file, line, and function

2001-03-19 Thread Tom Lane
Ian Lance Taylor [EMAIL PROTECTED] writes: Tom Lane [EMAIL PROTECTED] writes: BTW, how does that work exactly? I assume it can't be a macro ... It's a macro just like __FILE__ and __LINE__ are macros. gcc has supported __FUNCTION__ and __PRETTY_FUNCTION__ for a long time (the latter is

Re: [HACKERS] elog with automatic file, line, and function

2001-03-19 Thread Larry Rosenman
* Tom Lane [EMAIL PROTECTED] [010319 18:58]: Ian Lance Taylor [EMAIL PROTECTED] writes: Tom Lane [EMAIL PROTECTED] writes: BTW, how does that work exactly? I assume it can't be a macro ... It's a macro just like __FILE__ and __LINE__ are macros. gcc has supported __FUNCTION__ and

Re: [HACKERS] elog with automatic file, line, and function

2001-03-19 Thread Neal Norwitz
Peter Eisentraut wrote: It has been brought up that elog should be able to automatically fill in the file, line, and perhaps the function name where it's called, to avoid having to prefix each message with the function name by hand, which is quite ugly. This is doable, but it requires a