| Topic: |
DEVELOP > c-Plus-Plus |
| User: |
"Avinash" |
| Date: |
15 Dec 2004 12:21:10 AM |
| Object: |
Logging Mechanism in C++ |
Hello
I want to do some debugging stuff for my C++ program.
I want to have some mechanism by which I can pring function names at
runtime.
like
void function ()
{
LogMessage();
}
This LogMessage function should automatically take filename ( which is
possible using __FILE__ and line number using __LINE__ )
but how to get function name at runtime.
Thanks in Advance.
Avinash
.
|
|
| User: "Evan Carew" |
|
| Title: Re: Logging Mechanism in C++ |
15 Dec 2004 04:54:25 PM |
|
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Avinash wrote:
Hello
I want to do some debugging stuff for my C++ program.
I want to have some mechanism by which I can pring function names at
runtime.
like
void function ()
{
LogMessage();
}
This LogMessage function should automatically take filename ( which is
possible using __FILE__ and line number using __LINE__ )
but how to get function name at runtime.
Have a look at Boost's test facility at
http://www.boost.org/libs/test/doc/index.html
Thanks in Advance.
Avinash
Evan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFBwMChpxCQXwV2bJARAkkrAJ9E1Agm0hS+496vCsHfo7XTQuf5RACdFwg2
+wg6xm59Hpu/1Y6/bPcPRXs=
=y/Pz
-----END PGP SIGNATURE-----
.
|
|
|
|
| User: "Matthias =?ISO-8859-1?Q?K=E4ppler?=" |
|
| Title: Re: Logging Mechanism in C++ |
15 Dec 2004 12:43:40 AM |
|
|
Avinash wrote:
Hello
I want to do some debugging stuff for my C++ program.
I want to have some mechanism by which I can pring function names at
runtime.
like
void function ()
{
LogMessage();
}
This LogMessage function should automatically take filename ( which is
possible using __FILE__ and line number using __LINE__ )
but how to get function name at runtime.
Thanks in Advance.
Avinash
I'm not sure whether this is compiler specific, but I have written a
debugging mechanism for VC++ compilers some time ago, and I remember I used
__FUNCTION__ to log which function I'm currently debugging.
Regards,
Matthias
.
|
|
|
| User: "Default User" |
|
| Title: Re: Logging Mechanism in C++ |
15 Dec 2004 11:19:13 AM |
|
|
Matthias Käppler wrote:
Avinash wrote:
This LogMessage function should automatically take filename ( which
is possible using FILE and line number using LINE )
but how to get function name at runtime.
I'm not sure whether this is compiler specific, but I have written a
debugging mechanism for VC++ compilers some time ago, and I remember
I used __FUNCTION__ to log which function I'm currently debugging.
That's not a standard preprocessor identifier (it's gcc, I think). As
of the new C standard, the equivalent there is __func__. I don't know
whether C++ is in the process of adopting that or not.
Brian
.
|
|
|
| User: "Matthias =?ISO-8859-1?Q?K=E4ppler?=" |
|
| Title: Re: Logging Mechanism in C++ |
16 Dec 2004 01:59:31 AM |
|
|
Default User wrote:
That's not a standard preprocessor identifier (it's gcc, I think). As
of the new C standard, the equivalent there is __func__. I don't know
whether C++ is in the process of adopting that or not.
I used it with Microsoft Visual C++ 7. So it's probably not gcc specific,
but it may not be standard conformous either.
Does the C++ standard define any preprocessor makros at all? I thought that
would be a compiler/implementation thing.
.
|
|
|
|
|
| User: "Johan" |
|
| Title: Re: Logging Mechanism in C++ |
15 Dec 2004 10:27:13 AM |
|
|
have a look at log4cplus
Johan
"Matthias Käppler" <nospam@digitalraid.com> schreef in bericht
news:cpombo$j3t$03$1@news.t-online.com...
Avinash wrote:
Hello
I want to do some debugging stuff for my C++ program.
I want to have some mechanism by which I can pring function names at
runtime.
like
void function ()
{
LogMessage();
}
This LogMessage function should automatically take filename ( which is
possible using __FILE__ and line number using __LINE__ )
but how to get function name at runtime.
Thanks in Advance.
Avinash
I'm not sure whether this is compiler specific, but I have written a
debugging mechanism for VC++ compilers some time ago, and I remember I
used
__FUNCTION__ to log which function I'm currently debugging.
Regards,
Matthias
.
|
|
|
|
|

|
Related Articles |
|
|