summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
Diffstat (limited to 'api')
-rw-r--r--api/src/glfs.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/api/src/glfs.c b/api/src/glfs.c
index 3962a39da44..82873fe7699 100644
--- a/api/src/glfs.c
+++ b/api/src/glfs.c
@@ -499,13 +499,16 @@ glfs_set_volfile_server (struct glfs *fs, const char *transport,
int
glfs_set_logging (struct glfs *fs, const char *logfile, int loglevel)
{
- int ret = -1;
+ int ret = 0;
- ret = gf_log_init (fs->ctx, logfile);
- if (ret)
- return ret;
+ if (logfile) {
+ ret = gf_log_init (fs->ctx, logfile);
+ if (ret)
+ return ret;
+ }
- gf_log_set_loglevel (loglevel);
+ if (loglevel >= 0)
+ gf_log_set_loglevel (loglevel);
return ret;
}