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                [email protected]


Reply via email to