src.ctf.fs: honor component's initial log level
[babeltrace.git] / src / plugins / ctf / fs-src / file.c
index 585faef876d6f6e03ebd1c0de1b283cf396af37d..c1af7c6926ede5bcfeb6aaa3bf1325681dbf1cbc 100644 (file)
  * SOFTWARE.
  */
 
+#define BT_LOG_OUTPUT_LEVEL (file->log_level)
+#define BT_LOG_TAG "PLUGIN/SRC.CTF.FS/FILE"
+#include "logging/log.h"
+
 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -27,9 +31,6 @@
 #include <glib.h>
 #include "file.h"
 
-#define BT_LOG_TAG "PLUGIN-CTF-FS-FILE-SRC"
-#include "logging.h"
-
 BT_HIDDEN
 void ctf_fs_file_destroy(struct ctf_fs_file *file)
 {
@@ -56,7 +57,7 @@ void ctf_fs_file_destroy(struct ctf_fs_file *file)
 }
 
 BT_HIDDEN
-struct ctf_fs_file *ctf_fs_file_create(void)
+struct ctf_fs_file *ctf_fs_file_create(bt_logging_level log_level)
 {
        struct ctf_fs_file *file = g_new0(struct ctf_fs_file, 1);
 
@@ -64,6 +65,7 @@ struct ctf_fs_file *ctf_fs_file_create(void)
                goto error;
        }
 
+       file->log_level = log_level;
        file->path = g_string_new(NULL);
        if (!file->path) {
                goto error;
@@ -85,7 +87,7 @@ int ctf_fs_file_open(struct ctf_fs_file *file, const char *mode)
        int ret = 0;
        struct stat stat;
 
-       BT_LOGD("Opening file \"%s\" with mode \"%s\"", file->path->str, mode);
+       BT_LOGI("Opening file \"%s\" with mode \"%s\"", file->path->str, mode);
        file->fp = fopen(file->path->str, mode);
        if (!file->fp) {
                BT_LOGE("Cannot open file \"%s\" with mode \"%s\": %s",
@@ -93,7 +95,7 @@ int ctf_fs_file_open(struct ctf_fs_file *file, const char *mode)
                goto error;
        }
 
-       BT_LOGD("Opened file: %p", file->fp);
+       BT_LOGI("Opened file: %p", file->fp);
 
        if (fstat(fileno(file->fp), &stat)) {
                BT_LOGE("Cannot get file information: %s", strerror(errno));
@@ -101,7 +103,7 @@ int ctf_fs_file_open(struct ctf_fs_file *file, const char *mode)
        }
 
        file->size = stat.st_size;
-       BT_LOGD("File is %jd bytes", (intmax_t) file->size);
+       BT_LOGI("File is %jd bytes", (intmax_t) file->size);
        goto end;
 
 error:
This page took 0.02513 seconds and 4 git commands to generate.