forked from Bananymous/banan-os
				
			LibC: Cleanup syslog output
add ": " after the identification and formatted output. syslog does not require trailing newline so add it in case it is missing.
This commit is contained in:
		
							parent
							
								
									df8365f0c7
								
							
						
					
					
						commit
						70bbdbd8f5
					
				|  | @ -1,5 +1,6 @@ | ||||||
| #include <stdarg.h> | #include <stdarg.h> | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
|  | #include <string.h> | ||||||
| #include <syslog.h> | #include <syslog.h> | ||||||
| 
 | 
 | ||||||
| static const char* s_ident = nullptr; | static const char* s_ident = nullptr; | ||||||
|  | @ -20,11 +21,15 @@ void syslog(int priority, const char* format, ...) | ||||||
| { | { | ||||||
| 	(void)priority; | 	(void)priority; | ||||||
| 	if (s_ident) | 	if (s_ident) | ||||||
| 		fprintf(s_log_file, "%s", s_ident); | 		fprintf(s_log_file, "%s: ", s_ident); | ||||||
| 	va_list args; | 	va_list args; | ||||||
| 	va_start(args, format); | 	va_start(args, format); | ||||||
| 	vfprintf(s_log_file, format, args); | 	vfprintf(s_log_file, format, args); | ||||||
| 	va_end(args); | 	va_end(args); | ||||||
|  | 
 | ||||||
|  | 	const size_t format_len = strlen(format); | ||||||
|  | 	if (format_len && format[format_len - 1] != '\n') | ||||||
|  | 		fputc('\n', s_log_file); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void closelog() | void closelog() | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue