]> pilppa.org Git - libplpha.git/blobdiff - src/process_parser.c
copy headers with make install, start integrating sysout methods to use libplp
[libplpha.git] / src / process_parser.c
index 2dffddac44e0477028836084c3cd98462db3e8ac..dcc4af82e6209fd0e5897270038c0229773d08cc 100644 (file)
@@ -10,6 +10,7 @@
 #include <dirent.h>
 #include <uci.h>
 
+#include <plp/log.h>
 #include "common.h"
 #include "process_parser.h"
 
@@ -47,7 +48,7 @@ t_process_arg_list *parse_command_line_args(char *cmd_line_param) {
                                        len++;
                                }
                                ret_val->arg_arr[ret_val->count]        = strndup(start, len);
-                               printf("ret_val[%d] = %s\n", ret_val->count, ret_val->arg_arr[ret_val->count]);
+                               log_debug("ret_val[%d] = %s\n", ret_val->count, ret_val->arg_arr[ret_val->count]);
                                ret_val->count                          = ret_val->count + 1;
                        }
                        else {
@@ -120,10 +121,11 @@ t_process_info_list *get_process_config_list() {
                                                option  = uci_lookup_option(ctx, section, "ExecStart");
                                                switch (option->type) {
                                                        case UCI_TYPE_STRING:
-                                                               printf("config file: %s name: %s, value: %s\n", *config_file, option->e.name, option->v.string);
+                                                               log_info("config file: %s name: %s, value: %s\n", *config_file, option->e.name, option->v.string);
                                                                add_process_config(ret_val, option);
                                                                break;
                                                        default:
+                                                               log_error("config file: can not parse parameter value");
                                                                break;
                                                }
                                        }
@@ -141,12 +143,12 @@ t_process_info_list *get_process_config_list() {
                        free(config_list);
                }
                else {
-                       printf("Failed to read service configurations from directory: %s\n", CONST_SERVICE_DIRECTORY_LOCATION);
+                       log_error("Failed to read service configurations from directory: %s\n", CONST_SERVICE_DIRECTORY_LOCATION);
                }
                uci_free_context(ctx);
        }
        else {
-               printf("Failed to read service configurations from directory: %s\n Memory allocation error.", CONST_SERVICE_DIRECTORY_LOCATION);
+               log_error("Failed to read service configurations from directory: %s\n Memory allocation error.", CONST_SERVICE_DIRECTORY_LOCATION);
        }
        return ret_val;
 }