From 1eba27a50a2539fcdb34074870690b57df543f85 Mon Sep 17 00:00:00 2001 From: Takeshi Nakatani Date: Sun, 15 Oct 2017 06:45:19 +0000 Subject: [PATCH] Refixed s3fs_init message(ref #652) --- src/common.h | 8 ++++++++ src/s3fs.cpp | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/common.h b/src/common.h index 5eac777..45396d3 100644 --- a/src/common.h +++ b/src/common.h @@ -100,6 +100,14 @@ enum s3fs_log_level{ syslog(S3FS_LOG_LEVEL_TO_SYSLOG(S3FS_LOG_CRIT), "s3fs: " fmt "%s", __VA_ARGS__); \ } +// Special macro for init message +#define S3FS_PRN_INIT_INFO(fmt, ...) \ + if(foreground){ \ + fprintf(stdout, "%s%s%s:%s(%d): " fmt "%s\n", S3FS_LOG_LEVEL_STRING(S3FS_LOG_INFO), S3FS_LOG_NEST(0), __FILE__, __func__, __LINE__, __VA_ARGS__, ""); \ + }else{ \ + syslog(S3FS_LOG_LEVEL_TO_SYSLOG(S3FS_LOG_INFO), "%s" fmt "%s", S3FS_LOG_NEST(0), __VA_ARGS__, ""); \ + } + // [NOTE] // small trick for VA_ARGS // diff --git a/src/s3fs.cpp b/src/s3fs.cpp index 45f4780..2005af7 100644 --- a/src/s3fs.cpp +++ b/src/s3fs.cpp @@ -3364,7 +3364,7 @@ static void s3fs_exit_fuseloop(int exit_status) { static void* s3fs_init(struct fuse_conn_info* conn) { - S3FS_PRN_INFO("init v%s(commit:%s) with %s", VERSION, COMMIT_HASH_VAL, s3fs_crypt_lib_name()); + S3FS_PRN_INIT_INFO("init v%s(commit:%s) with %s", VERSION, COMMIT_HASH_VAL, s3fs_crypt_lib_name()); // cache(remove cache dirs at first) if(is_remove_cache && (!CacheFileStat::DeleteCacheFileStatDirectory() || !FdManager::DeleteCacheDirectory())){