/* 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[] =
if (!filename)
fp = stderr;
-
- if (filename) {
+ else {
/* Purge the log file if the max size is defined. */
if (maxsize) {
fp = fopen(filename, "r");
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);
+ silc_debug_string = silc_string_regexify(debug_string);
+}