diff options
| author | 2008-10-24 13:55:48 +0000 | |
|---|---|---|
| committer | 2008-10-24 13:55:48 +0000 | |
| commit | 19bbdd68a491721dd4aeff7cacea51148ce3a9b9 (patch) | |
| tree | 4e143a77f879f7baf65797c08a4e3a489b4ac755 /utility/shell.c | |
| parent | 50af087b9f3831285869dc8d8bf91cc3e6d5169a (diff) | |
add logging function
added @todo tags for what needs to be finished
Diffstat (limited to 'utility/shell.c')
| -rw-r--r-- | utility/shell.c | 20 | 
1 files changed, 16 insertions, 4 deletions
| diff --git a/utility/shell.c b/utility/shell.c index 94cca35..b289bce 100644 --- a/utility/shell.c +++ b/utility/shell.c | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #include "config.h" | 10 | #include "config.h" | 
| 11 | #include "logparse.h" | 11 | #include "logparse.h" | 
| 12 | #include "database.h" | 12 | #include "database.h" | 
| 13 | #include "util.h" | ||
| 13 | 14 | ||
| 14 | const apr_getopt_option_t _opt_config[] = { | 15 | const apr_getopt_option_t _opt_config[] = { | 
| 15 | {"machineid", 'm', 1, "Machine ID for the log file"}, | 16 | {"machineid", 'm', 1, "Machine ID for the log file"}, | 
| @@ -127,6 +128,7 @@ int main(int argc, const char *const argv[]) | |||
| 127 | parser_init(pool); | 128 | parser_init(pool); | 
| 128 | config_init(pool); | 129 | config_init(pool); | 
| 129 | database_init(pool); | 130 | database_init(pool); | 
| 131 | logging_init(pool); | ||
| 130 | // Process configuration file | 132 | // Process configuration file | 
| 131 | base = config_create(pool); | 133 | base = config_create(pool); | 
| 132 | rv = config_read(base, apr_table_get(args,"Config"), args); | 134 | rv = config_read(base, apr_table_get(args,"Config"), args); | 
| @@ -139,11 +141,18 @@ int main(int argc, const char *const argv[]) | |||
| 139 | } | 141 | } | 
| 140 | config_dump(base); | 142 | config_dump(base); | 
| 141 | 143 | ||
| 144 | if (config_check(base)) { | ||
| 145 | printf("Please correct the configuration\n"); | ||
| 146 | exit(1); | ||
| 147 | } | ||
| 148 | |||
| 142 | // Find files and parse | 149 | // Find files and parse | 
| 143 | parser_find_logs(base); | 150 | parser_find_logs(base); | 
| 144 | if ((rv = database_connect(base))) { | 151 | if (!base->dryrun) { | 
| 145 | printf("Error Connecting to Database: %d\n",rv); | 152 | if ((rv = database_connect(base))) { | 
| 146 | exit(1); | 153 | printf("Error Connecting to Database: %d\n",rv); | 
| 154 | exit(1); | ||
| 155 | } | ||
| 147 | } | 156 | } | 
| 148 | if (!apr_is_empty_array(base->input_files)) { | 157 | if (!apr_is_empty_array(base->input_files)) { | 
| 149 | char **filelist; | 158 | char **filelist; | 
| @@ -156,6 +165,9 @@ int main(int argc, const char *const argv[]) | |||
| 156 | } else { | 165 | } else { | 
| 157 | printf("No input files\n"); | 166 | printf("No input files\n"); | 
| 158 | } | 167 | } | 
| 159 | database_disconnect(base); | 168 | if (!base->dryrun) { | 
| 169 | database_disconnect(base); | ||
| 170 | } | ||
| 171 | /** @todo summary goes here */ | ||
| 160 | return 0; | 172 | return 0; | 
| 161 | } | 173 | } | 
