From ffa927fa361c366d8d1d2fefdeb58d0977ab91ae Mon Sep 17 00:00:00 2001 From: Maxim Biro Date: Thu, 31 Dec 2015 20:01:24 -0500 Subject: Rename LOGGER_BACKEND to LOG_BACKEND --- other/bootstrap_daemon/src/log.c | 12 ++++++------ other/bootstrap_daemon/src/log.h | 10 +++++----- other/bootstrap_daemon/src/tox-bootstrapd.c | 14 +++++++------- 3 files changed, 18 insertions(+), 18 deletions(-) (limited to 'other/bootstrap_daemon/src') diff --git a/other/bootstrap_daemon/src/log.c b/other/bootstrap_daemon/src/log.c index b5f838fb..f41b8420 100644 --- a/other/bootstrap_daemon/src/log.c +++ b/other/bootstrap_daemon/src/log.c @@ -30,15 +30,15 @@ #include #include -LOGGER_BACKEND current_backend = -1; +LOG_BACKEND current_backend = -1; -bool open_log(LOGGER_BACKEND backend) +bool open_log(LOG_BACKEND backend) { if (current_backend != -1) { return false; } - if (backend == LOGGER_BACKEND_SYSLOG) { + if (backend == LOG_BACKEND_SYSLOG) { openlog(DAEMON_NAME, LOG_NOWAIT | LOG_PID, LOG_DAEMON); } @@ -53,7 +53,7 @@ bool close_log() return false; } - if (current_backend == LOGGER_BACKEND_SYSLOG) { + if (current_backend == LOG_BACKEND_SYSLOG) { closelog(); } @@ -101,10 +101,10 @@ bool write_log(LOG_LEVEL level, const char *format, ...) va_start(args, format); switch (current_backend) { - case LOGGER_BACKEND_SYSLOG: + case LOG_BACKEND_SYSLOG: log_syslog(level, format, args); break; - case LOGGER_BACKEND_STDOUT: + case LOG_BACKEND_STDOUT: log_stdout(level, format, args); break; } diff --git a/other/bootstrap_daemon/src/log.h b/other/bootstrap_daemon/src/log.h index b97d3733..b7712368 100644 --- a/other/bootstrap_daemon/src/log.h +++ b/other/bootstrap_daemon/src/log.h @@ -26,10 +26,10 @@ #include -typedef enum LOGGER_BACKEND { - LOGGER_BACKEND_SYSLOG, - LOGGER_BACKEND_STDOUT -} LOGGER_BACKEND; +typedef enum LOG_BACKEND { + LOG_BACKEND_SYSLOG, + LOG_BACKEND_STDOUT +} LOG_BACKEND; typedef enum LOG_LEVEL { LOG_LEVEL_INFO, @@ -42,7 +42,7 @@ typedef enum LOG_LEVEL { * @param backend Specifies which backend to use. * @return true on success, flase if log is already opened. */ -bool open_log(LOGGER_BACKEND backend); +bool open_log(LOG_BACKEND backend); /** * Releases all used resources by the logger. diff --git a/other/bootstrap_daemon/src/tox-bootstrapd.c b/other/bootstrap_daemon/src/tox-bootstrapd.c index e2bf7ade..3bbddf98 100644 --- a/other/bootstrap_daemon/src/tox-bootstrapd.c +++ b/other/bootstrap_daemon/src/tox-bootstrapd.c @@ -544,7 +544,7 @@ bool print_help() // Handels command line arguments, setting cfg_file_path and log_backend. // Terminates the application if incorrect arguments are specified. -void handle_command_line_arguments(int argc, char *argv[], char **cfg_file_path, LOGGER_BACKEND *log_backend) +void handle_command_line_arguments(int argc, char *argv[], char **cfg_file_path, LOG_BACKEND *log_backend) { if (argc < 2) { write_log(LOG_LEVEL_ERROR, "Error: No arguments provided.\n\n"); @@ -581,10 +581,10 @@ void handle_command_line_arguments(int argc, char *argv[], char **cfg_file_path, case 'l': if (strcmp(optarg, "syslog") == 0) { - *log_backend = LOGGER_BACKEND_SYSLOG; + *log_backend = LOG_BACKEND_SYSLOG; log_backend_set = true; } else if (strcmp(optarg, "stdout") == 0) { - *log_backend = LOGGER_BACKEND_STDOUT; + *log_backend = LOG_BACKEND_STDOUT; log_backend_set = true; } else { write_log(LOG_LEVEL_ERROR, "Error: Invalid BACKEND value for --log-backend option passed: %s\n\n", optarg); @@ -610,7 +610,7 @@ void handle_command_line_arguments(int argc, char *argv[], char **cfg_file_path, } if (!log_backend_set) { - *log_backend = LOGGER_BACKEND_SYSLOG; + *log_backend = LOG_BACKEND_SYSLOG; } if (!cfg_file_path_set) { @@ -623,10 +623,10 @@ void handle_command_line_arguments(int argc, char *argv[], char **cfg_file_path, int main(int argc, char *argv[]) { char *cfg_file_path; - LOGGER_BACKEND log_backend; + LOG_BACKEND log_backend; // choose backend for printing command line argument parsing output based on whether the daemon is being run from a terminal - log_backend = isatty(STDOUT_FILENO) ? LOGGER_BACKEND_STDOUT : LOGGER_BACKEND_SYSLOG; + log_backend = isatty(STDOUT_FILENO) ? LOG_BACKEND_STDOUT : LOG_BACKEND_SYSLOG; open_log(log_backend); handle_command_line_arguments(argc, argv, &cfg_file_path, &log_backend); @@ -798,7 +798,7 @@ int main(int argc, char *argv[]) } // Go quiet - if (log_backend != LOGGER_BACKEND_STDOUT) { + if (log_backend != LOG_BACKEND_STDOUT) { close(STDOUT_FILENO); close(STDIN_FILENO); close(STDERR_FILENO); -- cgit v1.2.3