[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Logging in libssh
[Thread Prev] | [Thread Next]
- Subject: Logging in libssh
- From: Andreas Schneider <asn@xxxxxxxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Tue, 06 Sep 2011 00:15:35 +0200
- To: "libssh@xxxxxxxxxx" <libssh@xxxxxxxxxx>
Hey Aris,
in libssh 0.6 I would like to get rid of enter_function() and leave_function()
and introduce a new logging function. The logging function should be private.
Here is the idea how to do it.
#ifndef __LINESTR__
#define __LINESTR__ SSH_STRINGIFY(__LINE__)
#endif
#ifndef __location__
#define __location__ __FILE__ ":" __LINESTR__
#endif
void _ssh_log(ssh_session session, int verbosity, const char *format, ...)
PRINTF_ATTRIBUTE(3, 4);
#define SSH_LOG(session, verbosity, ...) \
_ssh_log(session, verbosity, __location__, __VA_ARGS__)
void _ssh_log(ssh_session session, int verbosity, const char *location, const
char *format, ...)
{
/* my code here */
}
instead of __location__ we could log __FUNCTION__
I think timestamps would be also good. We already introduced hires timers.
-- andreas
--
Andreas Schneider GPG-ID: F33E3FC6
www.cryptomilk.org asn@xxxxxxxxxxxxxx
| About copy many files. | Dairon Dominguez Vega <ddvega@xxxxxx> |