diff options
author | Aris Adamantiadis <aris@0xbadc0de.be> | 2008-06-12 20:14:17 +0000 |
---|---|---|
committer | Aris Adamantiadis <aris@0xbadc0de.be> | 2008-06-12 20:14:17 +0000 |
commit | fe51f9c7662b7391f80953bedc4fe61b89013913 (patch) | |
tree | 66e1390ec6f593ba32b7a881040a303fd2669653 /libssh/options.c | |
parent | b94422ef10bb083dde58e8c8349cc3e004888f9f (diff) | |
download | libssh-fe51f9c7662b7391f80953bedc4fe61b89013913.tar.gz libssh-fe51f9c7662b7391f80953bedc4fe61b89013913.tar.xz libssh-fe51f9c7662b7391f80953bedc4fe61b89013913.zip |
big changes :
Some documentation, and a new logging system.
some work must be done to get rid of the infamous ssh_say()
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@166 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh/options.c')
-rw-r--r-- | libssh/options.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/libssh/options.c b/libssh/options.c index cea7325e..570ef412 100644 --- a/libssh/options.c +++ b/libssh/options.c @@ -108,6 +108,8 @@ SSH_OPTIONS *ssh_options_copy(SSH_OPTIONS *opt){ ret->timeout_usec=opt->timeout_usec; ret->ssh2allowed=opt->ssh2allowed; ret->ssh1allowed=opt->ssh1allowed; + ret->log_function=opt->log_function; + ret->log_verbosity=opt->log_verbosity; return ret; } @@ -406,6 +408,29 @@ void ssh_options_allow_ssh2(SSH_OPTIONS *opt, int allow){ opt->ssh2allowed=0; } +/** Default is a write on stderr + * \brief Change the writer callback for logging + * \param opt options structure + * \param callback a callback function for the printing + * \warning the message string may contain format string characters. + */ +void ssh_options_set_log_function(SSH_OPTIONS *opt, + void (*callback)(const char *message, SSH_SESSION *session, int priority )){ + opt->log_function=callback; +} + +/** \brief set this session's logging priority + * \param opt options structure + * \param verbosity verbosity of the messages. Every log smaller or equal to verbosity will be shown\n + * SSH_LOG_NOLOG No logging \n + * SSH_LOG_RARE Rare conditions or warnings\n + * SSH_LOG_ENTRY Api-accessible entrypoints\n + * SSH_LOG_PACKET Packet id and size\n + * SSH_LOG_FUNCTIONS function entering and leaving\n + */ +void ssh_options_set_log_verbosity(SSH_OPTIONS *opt, int verbosity){ + opt->log_verbosity=verbosity; +} /** * This is a helper for your application to generate the appropriate * options from the command line arguments.\n @@ -502,7 +527,7 @@ int ssh_options_getopt(SSH_OPTIONS *options, int *argcptr, char **argv){ ssh_set_error(options,SSH_FATAL,"either RSA or DSS must be chosen"); cont=0; } - ssh_set_verbosity(debuglevel); + ssh_options_set_log_verbosity(options,debuglevel); optind=saveoptind; if(!cont){ free(save); |