static void dispatch_event_reader_source(struct logger *server, struct epoll_event *event);
void reader_free(struct reader* reader);
static void logger_free(struct logger* l);
-static int parse_args(int argc, char **argv, struct buf_params *b);
int socket_initialize(struct sock_data *sock, struct log_buffer *buffer, service_socket_t service_socket, struct socket_config_data *data);
-static void help();
/** global state when logger is not interrupted by any handled signals */
static volatile sig_atomic_t g_logger_run = 1;
}
/**
+ * @brief Parse logfile line
+ * @detail Parses a logfile config line
+ * @param[in] key Config entry key
+ * @param[in] value Config entry value
+ * @param[in] userdata Userdata
+ */
+void parse_logfile_config(void *value, void *userdata)
+{
+ assert(value);
+ assert(userdata);
+
+ struct logger *server = (struct logger *) userdata;
+ struct reader *rd = NULL;
+ char *configline = (char *) value;
+
+ int r = parse_command_line(configline, NULL, server, &rd);
+ if (r == 0)
+ add_reader(server, rd);
+ else {
+ errno = -r;
+ printf("Warning: unable to add logutil reader for provided configuration. Ignoring.\n"
+ " Config line: %s\n"
+ " Reason given: %m\n",
+ configline);
+ }
+}
+
+#ifndef UNIT_TEST
+/**
* @brief Print help
* @details Prints basic usage tips
*/
* @param[out] b Buffering parameters
* @return 0 or 1 on success, else -errno. Nonzero if the program is to close.
*/
-int parse_args(int argc, char **argv, struct buf_params *b)
+static int parse_args(int argc, char **argv, struct buf_params *b)
{
int option;
}
/**
- * @brief Parse logfile line
- * @detail Parses a logfile config line
- * @param[in] key Config entry key
- * @param[in] value Config entry value
- * @param[in] userdata Userdata
- */
-void parse_logfile_config(void *value, void *userdata)
-{
- assert(value);
- assert(userdata);
-
- struct logger *server = (struct logger *) userdata;
- struct reader *rd = NULL;
- char *configline = (char *) value;
-
- int r = parse_command_line(configline, NULL, server, &rd);
- if (r == 0)
- add_reader(server, rd);
- else {
- errno = -r;
- printf("Warning: unable to add logutil reader for provided configuration. Ignoring.\n"
- " Config line: %s\n"
- " Reason given: %m\n",
- configline);
- }
-}
-
-/**
* @brief Finalize initialisation
* @details Do misc stuff needed at the end of the initialisation
* @param[in] data configuration dat to read logfiles config lines from
return 0;
}
-#ifndef UNIT_TEST
/**
* @brief The logger
* @return 0 on success, nonzero on failure