improved debug message

This commit is contained in:
Fufu Fang 2024-05-03 07:33:41 +01:00
parent 257bb22e80
commit 389a657170
No known key found for this signature in database
GPG Key ID: 8A4CB08B0A7E27CE
3 changed files with 10 additions and 2 deletions

View File

@ -143,9 +143,12 @@ fs_readdir(const char *path, void *buf, fuse_fill_dir_t dir_add,
(void) fi; (void) fi;
LinkTable *linktbl; LinkTable *linktbl;
#ifdef DEBUG
static int j = 0; static int j = 0;
lprintf(debug, "\n!!!!Calling fs_readdir for the %d time!!!!\n", j) lprintf(debug, "\n!!!!Calling fs_readdir for the %d time!!!!\n", j)
j++; j++;
#endif
linktbl = path_to_Link_LinkTable_new(path); linktbl = path_to_Link_LinkTable_new(path);
if (!linktbl) { if (!linktbl) {
return -ENOENT; return -ENOENT;

View File

@ -644,9 +644,12 @@ LinkTable *LinkTable_new(const char *url)
curl_free(unescaped_path); curl_free(unescaped_path);
curl_easy_cleanup(c); curl_easy_cleanup(c);
#ifdef DEBUG
static int i = 0; static int i = 0;
lprintf(debug, "\n!!!!Calling LinkTable_new for the %d time!!!!\n", i) lprintf(debug, "\n!!!!Calling LinkTable_new for the %d time!!!!\n", i)
i++; i++;
#endif
LinkTable_print(linktbl); LinkTable_print(linktbl);
return linktbl; return linktbl;

View File

@ -1,6 +1,7 @@
#ifndef LOG_H #ifndef LOG_H
#define LOG_H #define LOG_H
#define DEBUG 0
/** /**
* \brief Log types * \brief Log types
*/ */
@ -9,7 +10,7 @@ typedef enum {
error = 1 << 1, error = 1 << 1,
warning = 1 << 2, warning = 1 << 2,
info = 1 << 3, info = 1 << 3,
debug = 1 << 4, debug = DEBUG << 4,
link_lock_debug = 1 << 5, link_lock_debug = 1 << 5,
network_lock_debug = 1 << 6, network_lock_debug = 1 << 6,
cache_lock_debug = 1 << 7, cache_lock_debug = 1 << 7,
@ -40,9 +41,10 @@ void log_printf(LogType type, const char *file, const char *func, int line,
*/ */
#define lprintf(type, ...) \ #define lprintf(type, ...) \
log_printf(type, __FILE__, __func__, __LINE__, __VA_ARGS__); log_printf(type, __FILE__, __func__, __LINE__, __VA_ARGS__);
#endif
/** /**
* \brief Print the version information for HTTPDirFS * \brief Print the version information for HTTPDirFS
*/ */
void print_version(); void print_version();
#endif