static int logging_init (glusterfs_ctx_t *ctx) { cmd_args_t *cmd_args = NULL; int ret = 0; cmd_args = &ctx->cmd_args; if (cmd_args->log_file == NULL) { ret = set_log_file_path (cmd_args); if (ret == -1) { fprintf (stderr, "failed to set the log file path.. " "exiting\n"); return -1; } } if (gf_log_init (cmd_args->log_file) == -1) { fprintf (stderr, "failed to open logfile %s. exiting\n", cmd_args->log_file); return -1; } gf_log_set_loglevel (cmd_args->log_level); return 0; }
static int logging_init (glusterfs_ctx_t *ctx) { cmd_args_t *cmd_args = NULL; cmd_args = &ctx->cmd_args; if (gf_log_init (cmd_args->log_file) == -1) { fprintf (stderr, "ERROR: failed to open logfile %s\n", cmd_args->log_file); return -1; } gf_log_set_loglevel (cmd_args->log_level); return 0; }
static int logging_init (glusterfs_ctx_t *ctx, struct cli_state *state) { char *log_file = state->log_file ? state->log_file : DEFAULT_CLI_LOG_FILE_DIRECTORY "/cli.log"; if (gf_log_init (ctx, log_file) == -1) { fprintf (stderr, "ERROR: failed to open logfile %s\n", log_file); return -1; } /* CLI should not have something to DEBUG after the release, hence defaulting to INFO loglevel */ gf_log_set_loglevel ((state->log_level == -1) ? GF_LOG_INFO : state->log_level); return 0; }