+Wed Nov 7 17:15:07 EET 2001 Pekka Riikonen <priikone@silcnet.org>
+
+ * Added silc_log_set_debug_string function to set a regex
+ string to match for debug output. Only the function names,
+ or filenames matching the given debug string is actually
+ printed. This way it is possible to filter out those debug
+ strings that user is not interested in.
+
+ Fixed a bug in silc_string_regexify.
+
+ Affected files lib/silcutil/silclog.[ch], and
+ lib/silcutil/unix/silcunixutil.c.
+
+ * Changed the -d options in both server and Irssi SILC client
+ to take the debug string as argument. Affected files
+ silcd/silcd.c and irssi/src/silc/core/silc-core.c.
+
Tue Nov 6 21:31:54 EET 2001 Pekka Riikonen <priikone@silcnet.org>
* Added silc_hash_babbleprint to create a Bubble Babble
match for everything, and all debugs will be printed. If you want to
limit the debugs you want to printout you can give for example a string
like "*server*,*rng*" to match all functions, and filenames that has
-"server" or "rng" string in them. Others will not be printed out. You
-can freely define regural expressions as debug string.
+"server" or "rng" string in them. Others will not be printed out.
Howto Clean SILC Source Tree
/* Command line option variables */
static bool opt_create_keypair = FALSE;
-static bool opt_debug = FALSE;
static bool opt_list_ciphers = FALSE;
static bool opt_list_hash = FALSE;
static bool opt_list_hmac = FALSE;
static bool opt_list_pkcs = FALSE;
static bool opt_version = FALSE;
+static char *opt_debug = FALSE;
static char *opt_pkcs = NULL;
static char *opt_keyfile = NULL;
static int opt_bits = 0;
"List supported HMACs", NULL },
{ "list-pkcs", 'P', POPT_ARG_NONE, &opt_list_pkcs, 0,
"List supported PKCSs", NULL },
- { "debug", 'd', POPT_ARG_NONE, &opt_debug, 0,
+ { "debug", 'd', POPT_ARG_STRING, &opt_debug, 0,
"Enable debugging", NULL },
{ "version", 'V', POPT_ARG_NONE, &opt_version, 0,
"Show version", NULL },
exit(0);
}
- silc_debug = opt_debug;
- silc_log_set_callbacks(silc_log_info, silc_log_warning,
- silc_log_error, NULL);
+ if (opt_debug) {
+ silc_debug = TRUE;
+ silc_log_set_debug_string(opt_debug);
+ silc_log_set_callbacks(silc_log_info, silc_log_warning,
+ silc_log_error, NULL);
+ }
/* Do some irssi initializing */
settings_add_bool("server", "skip_motd", FALSE);
\n\
Generic Options:\n\
-f --config-file=FILE Alternate configuration file\n\
- -d --debug=string Enable debugging (no daemon)\n\
+ -d --debug Enable debugging (no daemon)\n\
-h --help Display this message\n\
-V --version Display version\n\
\n\
/* Set TRUE/FALSE to enable/disable debugging */
int silc_debug = FALSE;
+char *silc_debug_string = NULL;
/* SILC Log name strings. These strings are printed to the log file. */
const SilcLogTypeName silc_log_types[] =
return;
}
+ if (silc_debug_string &&
+ (!silc_string_regex_match(silc_debug_string, file) &&
+ !silc_string_regex_match(silc_debug_string, function))) {
+ silc_free(string);
+ return;
+ }
+
if (debug_cb)
{
(*debug_cb)(file, function, line, string);
return;
}
+ if (silc_debug_string &&
+ (!silc_string_regex_match(silc_debug_string, file) &&
+ !silc_string_regex_match(silc_debug_string, function))) {
+ silc_free(string);
+ return;
+ }
+
if (debug_hexdump_cb)
{
(*debug_hexdump_cb)(file, function, line, data_in, len, string);
debug_cb = NULL;
debug_hexdump_cb = NULL;
}
+
+/* Set current debug string */
+
+void silc_log_set_debug_string(const char *debug_string)
+{
+ silc_free(silc_debug_string);
+ if (strchr(debug_string, '(') &&
+ strchr(debug_string, ')'))
+ silc_debug_string = strdup(debug_string);
+ else
+ silc_debug_string = silc_string_regexify(debug_string);
+}
/* Set TRUE/FALSE to enable/disable debugging */
extern int silc_debug;
+extern char *silc_debug_string;
/* SILC Log types */
typedef enum {
void silc_log_set_debug_callbacks(SilcDebugCb debug,
SilcDebugHexdumpCb debug_hexdump);
void silc_log_reset_debug_callbacks();
+void silc_log_set_debug_string(const char *debug_string);
#endif
count++;
}
- regex[count - 1] = ')';
+ regex[count++] = ')';
regex[count] = '$';
return regex;