mirror of
				https://github.com/berlin-open-wireless-lab/DAWN.git
				synced 2025-03-09 15:40:12 +00:00 
			
		
		
		
	treewide: improve logging
Provide multi-priority syslog() based logging to improve user and developer experience. Add dawnlog_* functions and macros to convert printf() family and perror() logging to syslog() family. Removed unnecessary sprintf() for building log strings (embed format directly). Add local config settings for log level. Add command line parameters for log level and destination. Set default log level to suppress a lot of previously noisy messages. Restore some previously removed noisy messages as DEBUG level in case they help in future. Eliminate DAWN_NO_OUTPUT static code checks which are no longer used. Signed-off-by: Ian Clowes <clowes_ian@hotmail.com>
This commit is contained in:
		
							parent
							
								
									ddc007e32c
								
							
						
					
					
						commit
						4df0c986f1
					
				
					 18 changed files with 922 additions and 396 deletions
				
			
		|  | @ -493,7 +493,8 @@ static int consume_actions(int argc, char* argv[], int harness_verbosity) | |||
|         { | ||||
|             args_required = 1; | ||||
| 
 | ||||
|             print_probe_array(); | ||||
|             if (dawnlog_showing(DAWNLOG_INFO)) | ||||
|                 print_probe_array(); | ||||
|         } | ||||
|         else if (strcmp(*argv, "client_show") == 0) | ||||
|         { | ||||
|  | @ -505,11 +506,11 @@ static int consume_actions(int argc, char* argv[], int harness_verbosity) | |||
|         { | ||||
|             args_required = 1; | ||||
| 
 | ||||
|             printf("--------APs------\n"); | ||||
|             dawnlog_info("--------APs------\n"); | ||||
|             for (auth_entry *i = denied_req_set; i != NULL; i = i->next_auth) { | ||||
|                 print_auth_entry(i); | ||||
|                 print_auth_entry(DAWNLOG_INFO, i); | ||||
|             } | ||||
|             printf("------------------\n"); | ||||
|             dawnlog_info("------------------\n"); | ||||
|         } | ||||
|         else if (strcmp(*argv, "ap_add_auto") == 0) | ||||
|         { | ||||
|  | @ -893,11 +894,9 @@ static int consume_actions(int argc, char* argv[], int harness_verbosity) | |||
|                 else if (!strncmp(fn, "vht_cap=", 8)) load_u8(&pr0->vht_capabilities, fn + 8); | ||||
|                 else if (!strncmp(fn, "time=", 5)) load_time(&pr0->time, fn + 5); | ||||
|                 else if (!strncmp(fn, "counter=", 8)) load_int(&pr0->counter, fn + 8); | ||||
| #ifndef DAWN_NO_OUTPUT | ||||
|                 else if (!strncmp(fn, "deny=", 5)) load_int(&pr0->deny_counter, fn + 5); | ||||
|                 else if (!strncmp(fn, "max_rate=", 9)) load_u8(&pr0->max_supp_datarate, fn + 9); | ||||
|                 else if (!strncmp(fn, "min_rate=", 9)) load_u8(&pr0->min_supp_datarate, fn + 9); | ||||
| #endif | ||||
|                 else if (!strncmp(fn, "rcpi=", 5)) load_u32(&pr0->rcpi, fn + 5); | ||||
|                 else if (!strncmp(fn, "rsni=", 5)) load_u32(&pr0->rsni, fn + 5); | ||||
|                 else { | ||||
|  | @ -936,11 +935,9 @@ static int consume_actions(int argc, char* argv[], int harness_verbosity) | |||
|                         pr0->vht_capabilities = 0; | ||||
|                         pr0->time = faketime; | ||||
|                         pr0->counter = 0; | ||||
| #ifndef DAWN_NO_OUTPUT | ||||
|                         pr0->deny_counter = 0; | ||||
|                         pr0->max_supp_datarate = 0; | ||||
|                         pr0->min_supp_datarate = 0; | ||||
| #endif | ||||
|                         pr0->rcpi = 0; | ||||
|                         pr0->rsni = 0; | ||||
| 
 | ||||
|  | @ -1072,6 +1069,9 @@ static int consume_actions(int argc, char* argv[], int harness_verbosity) | |||
|                     ap* ap_entry = ap_array_get_ap(pr0->bssid_addr, NULL); | ||||
| 
 | ||||
|                     int this_metric = eval_probe_metric(pr0, ap_entry); | ||||
|                     dawnlog_info("Score: %d of:\n", this_metric); | ||||
|                     print_probe_entry(DAWNLOG_DEBUG, pr0); | ||||
| 
 | ||||
|                     printf("eval_probe_metric: Returned %d\n", this_metric); | ||||
|                 } | ||||
| 
 | ||||
|  | @ -1184,6 +1184,8 @@ int main(int argc, char* argv[]) | |||
|     int ret = 0; | ||||
|     int harness_verbosity = 1; | ||||
| 
 | ||||
|     dawnlog_dest(DAWNLOG_DEST_STDIO); // Send messages to stderr / stdout
 | ||||
| 
 | ||||
|     printf("DAWN datastorage.c test harness...\n\n"); | ||||
| 
 | ||||
|     if ((argc == 1) || !strcmp(*(argv + 1), "help") || !strcmp(*(argv + 1), "--help") || !strcmp(*(argv + 1), "-h")) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue