struct SilcLogStruct {
char *filename;
FILE *fp;
- uint32 maxsize;
+ SilcUInt32 maxsize;
char *typename;
SilcLogType type;
SilcLogCb cb;
/* These are the known logging channels */
static struct SilcLogStruct silclogs[SILC_LOG_MAX] = {
{NULL, NULL, 0, "Info", SILC_LOG_INFO, NULL, NULL},
- {NULL, NULL, 0, "Error", SILC_LOG_ERROR, NULL, NULL},
{NULL, NULL, 0, "Warning", SILC_LOG_WARNING, NULL, NULL},
+ {NULL, NULL, 0, "Error", SILC_LOG_ERROR, NULL, NULL},
{NULL, NULL, 0, "Fatal", SILC_LOG_FATAL, NULL, NULL},
};
}
/* Set and initialize the specified logging channel. See the API reference */
-bool silc_log_set_file(SilcLogType type, char *filename, uint32 maxsize,
+bool silc_log_set_file(SilcLogType type, char *filename, SilcUInt32 maxsize,
SilcSchedule scheduler)
{
FILE *fp = NULL;
{
if (!silc_debug)
goto end;
+
if (silc_log_debug_string &&
- !silc_string_regex_match(silc_log_debug_string, file) &&
- !silc_string_regex_match(silc_log_debug_string, function))
+ !silc_string_regex_match(silc_log_debug_string, file) &&
+ !silc_string_regex_match(silc_log_debug_string, function))
goto end;
+
if (silc_log_debug_cb) {
if ((*silc_log_debug_cb)(file, function, line, string,
silc_log_debug_context))
goto end;
}
+
fprintf(stderr, "%s:%d: %s\n", function, line, string);
fflush(stderr);
-end:
+
+ end:
silc_free(string);
}
void silc_log_output_hexdump(char *file, char *function,
int line, void *data_in,
- uint32 len, char *string)
+ SilcUInt32 len, char *string)
{
int i, k;
int off, pos, count;
if (!silc_debug_hexdump)
goto end;
+
if (silc_log_debug_string &&
- !silc_string_regex_match(silc_log_debug_string, file) &&
- !silc_string_regex_match(silc_log_debug_string, function))
+ !silc_string_regex_match(silc_log_debug_string, file) &&
+ !silc_string_regex_match(silc_log_debug_string, function))
goto end;
+
if (silc_log_hexdump_cb) {
if ((*silc_log_hexdump_cb)(file, function, line, data_in, len, string,
silc_log_hexdump_context))
}
fprintf(stderr, "%s:%d: %s\n", function, line, string);
- silc_free(string);
k = 0;
pos = 0;
if (count < 16)
break;
}
- return;
-end:
+ end:
silc_free(string);
}