Translate fprintf statements into log messages
This commit is contained in:
		
							parent
							
								
									b5516be360
								
							
						
					
					
						commit
						19b364d67c
					
				
							
								
								
									
										42
									
								
								src/dbus.c
									
									
									
									
									
								
							
							
						
						
									
										42
									
								
								src/dbus.c
									
									
									
									
									
								
							| @ -7,6 +7,7 @@ | ||||
| #include <stdlib.h> | ||||
| 
 | ||||
| #include "dunst.h" | ||||
| #include "log.h" | ||||
| #include "notification.h" | ||||
| #include "queues.h" | ||||
| #include "settings.h" | ||||
| @ -100,8 +101,9 @@ void handle_method_call(GDBusConnection *connection, | ||||
|         } else if (g_strcmp0(method_name, "GetServerInformation") == 0) { | ||||
|                 on_get_server_information(connection, sender, parameters, invocation); | ||||
|         } else { | ||||
|                 fprintf(stderr, "WARNING: sender: %s; unknown method_name: %s\n", sender, | ||||
|                        method_name); | ||||
|                 LOG_M("Unknown method name: '%s' (sender: '%s').", | ||||
|                       method_name, | ||||
|                       sender); | ||||
|         } | ||||
| } | ||||
| 
 | ||||
| @ -342,14 +344,13 @@ static void on_get_server_information(GDBusConnection *connection, | ||||
| void signal_notification_closed(notification *n, enum reason reason) | ||||
| { | ||||
|         if (reason < REASON_MIN || REASON_MAX < reason) { | ||||
|                 fprintf(stderr, "ERROR: Closing notification with reason '%d' not supported. " | ||||
|                                 "Closing it with reason '%d'.\n", reason, REASON_UNDEF); | ||||
|                 LOG_W("Closing notification with reason '%d' not supported. " | ||||
|                       "Closing it with reason '%d'.", reason, REASON_UNDEF); | ||||
|                 reason = REASON_UNDEF; | ||||
|         } | ||||
| 
 | ||||
|         if (!dbus_conn) { | ||||
|                 fprintf(stderr, "ERROR: Tried to close notification but dbus connection not set!\n"); | ||||
|                 return; | ||||
|                 LOG_E("Unable to close notification: No DBus connection."); | ||||
|         } | ||||
| 
 | ||||
|         GVariant *body = g_variant_new("(uu)", n->id, reason); | ||||
| @ -364,7 +365,7 @@ void signal_notification_closed(notification *n, enum reason reason) | ||||
|                                       &err); | ||||
| 
 | ||||
|         if (err) { | ||||
|                 fprintf(stderr, "Unable to close notification: %s\n", err->message); | ||||
|                 LOG_W("Unable to close notification: %s", err->message); | ||||
|                 g_error_free(err); | ||||
|         } | ||||
| 
 | ||||
| @ -384,7 +385,7 @@ void signal_action_invoked(notification *n, const char *identifier) | ||||
|                                       &err); | ||||
| 
 | ||||
|         if (err) { | ||||
|                 fprintf(stderr, "Unable to invoke action: %s\n", err->message); | ||||
|                 LOG_W("Unable to invoke action: %s", err->message); | ||||
|                 g_error_free(err); | ||||
|         } | ||||
| } | ||||
| @ -410,8 +411,7 @@ static void on_bus_acquired(GDBusConnection *connection, | ||||
|                                                             &err); | ||||
| 
 | ||||
|         if (registration_id == 0) { | ||||
|                 fprintf(stderr, "Unable to register dbus connection: %s\n", err->message); | ||||
|                 exit(1); | ||||
|                 DIE("Unable to register dbus connection: %s", err->message); | ||||
|         } | ||||
| } | ||||
| 
 | ||||
| @ -536,14 +536,14 @@ static void on_name_lost(GDBusConnection *connection, | ||||
|         if (connection) { | ||||
|                 char *name = NULL; | ||||
|                 int pid = dbus_get_fdn_daemon_info(connection, &name, NULL); | ||||
|                 if (pid > 0) | ||||
|                         fprintf(stderr, "Cannot acquire '"FDN_NAME"': " | ||||
|                                 "Name is acquired by '%s' with PID '%d'.\n", name, pid); | ||||
|                 else | ||||
|                         fprintf(stderr, "Cannot acquire '"FDN_NAME"'.\n"); | ||||
| 
 | ||||
|                 if (pid > 0) { | ||||
|                         DIE("Cannot acquire '"FDN_NAME"': " | ||||
|                             "Name is acquired by '%s' with PID '%d'.", name, pid); | ||||
|                 } else { | ||||
|                         DIE("Cannot acquire '"FDN_NAME"'."); | ||||
|                 } | ||||
|         } else { | ||||
|                 fprintf(stderr, "Cannot connect to DBus.\n"); | ||||
|                 DIE("Cannot connect to DBus."); | ||||
|         } | ||||
|         exit(1); | ||||
| } | ||||
| @ -568,10 +568,10 @@ static RawImage *get_raw_image_from_data_hint(GVariant *icon_data) | ||||
|                 * ((image->n_channels * image->bits_per_sample + 7) / 8); | ||||
| 
 | ||||
|         if (expected_len != g_variant_get_size (data_variant)) { | ||||
|                 fprintf(stderr, "Expected image data to be of length %" G_GSIZE_FORMAT | ||||
|                        " but got a " "length of %" G_GSIZE_FORMAT, | ||||
|                        expected_len, | ||||
|                        g_variant_get_size (data_variant)); | ||||
|                 LOG_W("Expected image data to be of length %" G_GSIZE_FORMAT | ||||
|                       " but got a length of %" G_GSIZE_FORMAT, | ||||
|                       expected_len, | ||||
|                       g_variant_get_size(data_variant)); | ||||
|                 g_free(image); | ||||
|                 g_variant_unref(data_variant); | ||||
|                 return NULL; | ||||
|  | ||||
							
								
								
									
										18
									
								
								src/markup.c
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								src/markup.c
									
									
									
									
									
								
							| @ -7,6 +7,7 @@ | ||||
| #include <string.h> | ||||
| #include <stdio.h> | ||||
| 
 | ||||
| #include "log.h" | ||||
| #include "settings.h" | ||||
| #include "utils.h" | ||||
| 
 | ||||
| @ -68,17 +69,15 @@ void markup_strip_a(char **str, char **urls) | ||||
| 
 | ||||
|                 // the tag is broken, ignore it
 | ||||
|                 if (!tag1_end) { | ||||
|                         fprintf(stderr, | ||||
|                                 "WARNING: Given link is broken: '%s'\n", | ||||
|                                 tag1); | ||||
|                         LOG_W("Given link is broken: '%s'", | ||||
|                               tag1); | ||||
|                         string_replace_at(*str, tag1-*str, strlen(tag1), ""); | ||||
|                         break; | ||||
|                 } | ||||
|                 if (tag2 && tag2 < tag1_end) { | ||||
|                         int repl_len =  (tag2 - tag1) + strlen("</a>"); | ||||
|                         fprintf(stderr, | ||||
|                                 "WARNING: Given link is broken: '%.*s.'\n", | ||||
|                                 repl_len, tag1); | ||||
|                         LOG_W("Given link is broken: '%.*s.'", | ||||
|                               repl_len, tag1); | ||||
|                         string_replace_at(*str, tag1-*str, repl_len, ""); | ||||
|                         break; | ||||
|                 } | ||||
| @ -147,7 +146,7 @@ void markup_strip_img(char **str, char **urls) | ||||
| 
 | ||||
|                 // the tag is broken, ignore it
 | ||||
|                 if (!end) { | ||||
|                         fprintf(stderr, "WARNING: Given image is broken: '%s'\n", start); | ||||
|                         LOG_W("Given image is broken: '%s'", start); | ||||
|                         string_replace_at(*str, start-*str, strlen(start), ""); | ||||
|                         break; | ||||
|                 } | ||||
| @ -188,9 +187,8 @@ void markup_strip_img(char **str, char **urls) | ||||
|                         text_src = g_strndup(src_s, src_e-src_s); | ||||
| 
 | ||||
|                 } else { | ||||
|                         fprintf(stderr, | ||||
|                                 "WARNING: Given image argument is broken: '%.*s'\n", | ||||
|                                 (int)(end-start), start); | ||||
|                          LOG_W("Given image argument is broken: '%.*s'", | ||||
|                                (int)(end-start), start); | ||||
|                 } | ||||
| 
 | ||||
|                 // replacement text for alt
 | ||||
|  | ||||
| @ -14,6 +14,7 @@ | ||||
| 
 | ||||
| #include "dbus.h" | ||||
| #include "dunst.h" | ||||
| #include "log.h" | ||||
| #include "notification.h" | ||||
| #include "queues.h" | ||||
| #include "settings.h" | ||||
| @ -134,7 +135,7 @@ void invoke_action(const char *action) | ||||
| 
 | ||||
|         char *appname_begin = strchr(action, '['); | ||||
|         if (!appname_begin) { | ||||
|                 printf("invalid action: %s\n", action); | ||||
|                 LOG_W("Invalid action: '%s'", action); | ||||
|                 return; | ||||
|         } | ||||
|         appname_begin++; | ||||
| @ -188,7 +189,7 @@ void dispatch_menu_result(const char *input) | ||||
| void context_menu(void) | ||||
| { | ||||
|         if (settings.dmenu_cmd == NULL) { | ||||
|                 fprintf(stderr, "dmenu command not set properly. Cowardly refusing to open the context menu.\n"); | ||||
|                 LOG_C("Unable to open dmenu: No dmenu command set."); | ||||
|                 return; | ||||
|         } | ||||
|         char *dmenu_input = NULL; | ||||
|  | ||||
| @ -15,6 +15,7 @@ | ||||
| 
 | ||||
| #include "dbus.h" | ||||
| #include "dunst.h" | ||||
| #include "log.h" | ||||
| #include "markup.h" | ||||
| #include "menu.h" | ||||
| #include "queues.h" | ||||
| @ -33,6 +34,7 @@ static void notification_dmenu_string(notification *n); | ||||
|  */ | ||||
| void notification_print(notification *n) | ||||
| { | ||||
|         //TODO: use logging info for this
 | ||||
|         printf("{\n"); | ||||
|         printf("\tappname: '%s'\n", n->appname); | ||||
|         printf("\tsummary: '%s'\n", n->summary); | ||||
| @ -416,12 +418,11 @@ static void notification_format_message(notification *n) | ||||
|                                 MARKUP_NO); | ||||
|                         break; | ||||
|                 case '\0': | ||||
|                         fprintf(stderr, "WARNING: format_string has trailing %% character." | ||||
|                                         "To escape it use %%%%."); | ||||
|                         LOG_W("format_string has trailing %% character. " | ||||
|                               "To escape it use %%%%."); | ||||
|                         break; | ||||
|                 default: | ||||
|                         fprintf(stderr, "WARNING: format_string %%%c" | ||||
|                                         " is unknown\n", substr[1]); | ||||
|                         LOG_W("format_string %%%c is unknown.", substr[1]); | ||||
|                         // shift substr pointer forward,
 | ||||
|                         // as we can't interpret the format string
 | ||||
|                         substr++; | ||||
|  | ||||
| @ -8,6 +8,7 @@ | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
| 
 | ||||
| #include "dunst.h" | ||||
| #include "log.h" | ||||
| #include "utils.h" | ||||
| 
 | ||||
| @ -239,10 +240,7 @@ int load_ini_file(FILE *fp) | ||||
|                 if (*start == '[') { | ||||
|                         char *end = strchr(start + 1, ']'); | ||||
|                         if (!end) { | ||||
|                                 fprintf(stderr, | ||||
|                                      "Warning: invalid config file at line %d\n", | ||||
|                                      line_num); | ||||
|                                 fprintf(stderr, "Missing ']'\n"); | ||||
|                                 LOG_W("Invalid config file at line %d: Missing ']'.", line_num); | ||||
|                                 continue; | ||||
|                         } | ||||
| 
 | ||||
| @ -256,10 +254,7 @@ int load_ini_file(FILE *fp) | ||||
| 
 | ||||
|                 char *equal = strchr(start + 1, '='); | ||||
|                 if (!equal) { | ||||
|                         fprintf(stderr, | ||||
|                                "Warning: invalid config file at line %d\n", | ||||
|                                line_num); | ||||
|                         fprintf(stderr, "Missing '='\n"); | ||||
|                         LOG_W("Invalid config file at line %d: Missing '='.", line_num); | ||||
|                         continue; | ||||
|                 } | ||||
| 
 | ||||
| @ -271,10 +266,7 @@ int load_ini_file(FILE *fp) | ||||
|                 if (quote) { | ||||
|                         char *closing_quote = strchr(quote + 1, '"'); | ||||
|                         if (!closing_quote) { | ||||
|                                 fprintf(stderr, | ||||
|                                      "Warning: invalid config file at line %d\n", | ||||
|                                      line_num); | ||||
|                                 fprintf(stderr, "Missing '\"'\n"); | ||||
|                                 LOG_W("Invalid config file at line %d: Missing '\"'.", line_num); | ||||
|                                 continue; | ||||
|                         } | ||||
|                 } else { | ||||
| @ -285,10 +277,7 @@ int load_ini_file(FILE *fp) | ||||
|                 value = g_strstrip(value); | ||||
| 
 | ||||
|                 if (!current_section) { | ||||
|                         fprintf(stderr, | ||||
|                                "Warning: invalid config file at line %d\n", | ||||
|                                line_num); | ||||
|                         fprintf(stderr, "Key value pair without a section\n"); | ||||
|                         LOG_W("Invalid config file at line %d: Key value pair without a section.", line_num); | ||||
|                         continue; | ||||
|                 } | ||||
| 
 | ||||
| @ -349,8 +338,7 @@ static const char *cmdline_get_value(const char *key) | ||||
| 
 | ||||
|         if (idx + 1 >= cmdline_argc) { | ||||
|                 /* the argument is missing */ | ||||
|                 fprintf(stderr, "Warning: %s, missing argument. Ignoring\n", | ||||
|                         key); | ||||
|                 LOG_W("%s: Missing argument. Ignoring.", key); | ||||
|                 return NULL; | ||||
|         } | ||||
|         return cmdline_argv[idx + 1]; | ||||
|  | ||||
| @ -7,6 +7,7 @@ | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| 
 | ||||
| #include "log.h" | ||||
| #include "notification.h" | ||||
| #include "settings.h" | ||||
| 
 | ||||
| @ -59,7 +60,7 @@ int queues_notification_insert(notification *n) | ||||
|                 if (settings.always_run_script) { | ||||
|                         notification_run_script(n); | ||||
|                 } | ||||
|                 printf("skipping notification: %s %s\n", n->body, n->summary); | ||||
|                 LOG_M("Skipping notification: '%s' '%s'", n->body, n->summary); | ||||
|                 return 0; | ||||
|         } | ||||
|         /* Do not insert the message if it's a command */ | ||||
|  | ||||
| @ -29,7 +29,7 @@ static void parse_follow_mode(const char *mode) | ||||
|         else if (strcmp(mode, "none") == 0) | ||||
|                 settings.f_mode = FOLLOW_NONE; | ||||
|         else { | ||||
|                 fprintf(stderr, "Warning: unknown follow mode: \"%s\"\n", mode); | ||||
|                 LOG_W("Unknown follow mode: '%s'", mode); | ||||
|                 settings.f_mode = FOLLOW_NONE; | ||||
|         } | ||||
| } | ||||
| @ -43,7 +43,7 @@ static enum markup_mode parse_markup_mode(const char *mode) | ||||
|         } else if (strcmp(mode, "full") == 0 || strcmp(mode, "yes") == 0) { | ||||
|                 return MARKUP_FULL; | ||||
|         } else { | ||||
|                 fprintf(stderr, "Warning: unknown markup mode: \"%s\"\n", mode); | ||||
|                 LOG_W("Unknown markup mode: '%s'", mode); | ||||
|                 return MARKUP_NO; | ||||
|         } | ||||
| } | ||||
| @ -61,9 +61,7 @@ static enum urgency ini_get_urgency(const char *section, const char *key, const | ||||
|                 else if (strcmp(urg, "critical") == 0) | ||||
|                         ret = URG_CRIT; | ||||
|                 else | ||||
|                         fprintf(stderr, | ||||
|                                 "unknown urgency: %s, ignoring\n", | ||||
|                                 urg); | ||||
|                         LOG_W("Unknown urgency: '%s'", urg); | ||||
|         } | ||||
|         g_free(urg); | ||||
|         return ret; | ||||
| @ -97,15 +95,15 @@ void load_settings(char *cmdline_config_path) | ||||
|                  * (before v0.2). */ | ||||
|                 config_file = xdgConfigOpen("dunstrc", "r", &xdg); | ||||
|                 if (config_file == NULL) { | ||||
|                         puts("no dunstrc found -> skipping\n"); | ||||
|                         LOG_W("No dunstrc found."); | ||||
|                         xdgWipeHandle(&xdg); | ||||
|                 } | ||||
|         } | ||||
| 
 | ||||
|         load_ini_file(config_file); | ||||
| #else | ||||
|         fprintf(stderr, "Warning: dunstrc parsing disabled. " | ||||
|                         "Using STATIC_CONFIG is deprecated behavior.\n"); | ||||
|         LOG_M("dunstrc parsing disabled. " | ||||
|               "Using STATIC_CONFIG is deprecated behavior."); | ||||
| #endif | ||||
| 
 | ||||
|         settings.per_monitor_dpi = option_get_bool( | ||||
| @ -136,7 +134,8 @@ void load_settings(char *cmdline_config_path) | ||||
|                         ); | ||||
| 
 | ||||
|                         settings.markup = (allow_markup ? MARKUP_FULL : MARKUP_STRIP); | ||||
|                         fprintf(stderr, "Warning: 'allow_markup' is deprecated, please use 'markup' instead.\n"); | ||||
|                         LOG_M("'allow_markup' is deprecated, please " | ||||
|                               "use 'markup' instead."); | ||||
|                 } | ||||
| 
 | ||||
|                 char *c = option_get_string( | ||||
| @ -196,7 +195,7 @@ void load_settings(char *cmdline_config_path) | ||||
|                 } else if (strcmp(c, "end") == 0) { | ||||
|                         settings.ellipsize = end; | ||||
|                 } else { | ||||
|                         fprintf(stderr, "Warning: unknown ellipsize value: \"%s\"\n", c); | ||||
|                         LOG_W("Unknown ellipsize value: '%s'", c); | ||||
|                         settings.ellipsize = defaults.ellipsize; | ||||
|                 } | ||||
|                 g_free(c); | ||||
| @ -284,8 +283,7 @@ void load_settings(char *cmdline_config_path) | ||||
|                         else if (strcmp(c, "right") == 0) | ||||
|                                 settings.align = right; | ||||
|                         else | ||||
|                                 fprintf(stderr, | ||||
|                                         "Warning: unknown alignment\n"); | ||||
|                                 LOG_W("Unknown alignment value: '%s'", c); | ||||
|                         g_free(c); | ||||
|                 } | ||||
|         } | ||||
| @ -387,8 +385,8 @@ void load_settings(char *cmdline_config_path) | ||||
|         { | ||||
|                 GError *error = NULL; | ||||
|                 if (!g_shell_parse_argv(settings.dmenu, NULL, &settings.dmenu_cmd, &error)) { | ||||
|                         fprintf(stderr, "Unable to parse dmenu command: %s\n", error->message); | ||||
|                         fprintf(stderr, "dmenu functionality will be disabled.\n"); | ||||
|                         LOG_W("Unable to parse dmenu command: '%s'." | ||||
|                               "dmenu functionality will be disabled.", error->message); | ||||
|                         g_error_free(error); | ||||
|                         settings.dmenu_cmd = NULL; | ||||
|                 } | ||||
| @ -416,8 +414,7 @@ void load_settings(char *cmdline_config_path) | ||||
|                         else if (strcmp(c, "off") == 0) | ||||
|                                 settings.icon_position = icons_off; | ||||
|                         else | ||||
|                                 fprintf(stderr, | ||||
|                                         "Warning: unknown icon position: %s\n", c); | ||||
|                                 LOG_W("Unknown icon position: '%s'", c); | ||||
|                         g_free(c); | ||||
|                 } | ||||
|         } | ||||
| @ -436,7 +433,7 @@ void load_settings(char *cmdline_config_path) | ||||
|                         "icon_folders", "-icon_folders", defaults.icon_path, | ||||
|                         "folders to default icons (deprecated, please use 'icon_path' instead)" | ||||
|                 ); | ||||
|                 fprintf(stderr, "Warning: 'icon_folders' is deprecated, please use 'icon_path' instead.\n"); | ||||
|                 LOG_M("The option 'icon_folders' is deprecated, please use 'icon_path' instead."); | ||||
|         } | ||||
|         // Read value and generate usage string for icon_path.
 | ||||
|         // If icon_path is set, override icon_folder.
 | ||||
| @ -456,7 +453,9 @@ void load_settings(char *cmdline_config_path) | ||||
|                                 "width", NULL, defaults.frame_width, | ||||
|                                 "Width of frame around the window" | ||||
|                         ); | ||||
|                         fprintf(stderr, "Warning: The frame section is deprecated, width has been renamed to frame_width and moved to the global section.\n"); | ||||
|                         LOG_M("The frame section is deprecated, width has " | ||||
|                               "been renamed to frame_width and moved to " | ||||
|                               "the global section."); | ||||
|                 } | ||||
| 
 | ||||
|                 settings.frame_width = option_get_int( | ||||
| @ -472,7 +471,9 @@ void load_settings(char *cmdline_config_path) | ||||
|                                 "color", NULL, defaults.frame_color, | ||||
|                                 "Color of the frame around the window" | ||||
|                         ); | ||||
|                         fprintf(stderr, "Warning: The frame section is deprecated, color has been renamed to frame_color and moved to the global section.\n"); | ||||
|                         LOG_M("The frame section is deprecated, color " | ||||
|                               "has been renamed to frame_color and moved " | ||||
|                               "to the global section."); | ||||
|                 } | ||||
| 
 | ||||
|                 settings.frame_color = option_get_string( | ||||
|  | ||||
| @ -136,13 +136,13 @@ gint64 string_to_time(const char *string) | ||||
|         gint64 val = strtoll(string, &endptr, 10); | ||||
| 
 | ||||
|         if (errno != 0) { | ||||
|                 fprintf(stderr, "ERROR: Time: '%s': %s.\n", string, strerror(errno)); | ||||
|                 LOG_W("Time: '%s': %s.", string, strerror(errno)); | ||||
|                 return 0; | ||||
|         } else if (string == endptr) { | ||||
|                 fprintf(stderr, "ERROR: Time: No digits found.\n"); | ||||
|                 LOG_W("Time: '%s': No digits found.", string); | ||||
|                 return 0; | ||||
|         } else if (errno != 0 && val == 0) { | ||||
|                 fprintf(stderr, "ERROR: Time: '%s' unknown error.\n", string); | ||||
|                 LOG_W("Time: '%s': Unknown error.", string); | ||||
|                 return 0; | ||||
|         } else if (errno == 0 && !*endptr) { | ||||
|                 return val * G_USEC_PER_SEC; | ||||
|  | ||||
| @ -15,6 +15,7 @@ | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
| 
 | ||||
| #include "src/log.h" | ||||
| #include "src/settings.h" | ||||
| #include "x.h" | ||||
| 
 | ||||
| @ -90,7 +91,8 @@ void randr_init() | ||||
| { | ||||
|         int randr_error_base = 0; | ||||
|         if (!XRRQueryExtension(xctx.dpy, &randr_event_base, &randr_error_base)) { | ||||
|                 fprintf(stderr, "Could not initialize the RandR extension, falling back to single monitor mode.\n"); | ||||
|                 LOG_W("Could not initialize the RandR extension. " | ||||
|                       "Falling back to single monitor mode."); | ||||
|                 return; | ||||
|         } | ||||
|         XRRQueryVersion(xctx.dpy, &randr_major_version, &randr_minor_version); | ||||
| @ -101,9 +103,10 @@ void randr_update() | ||||
| { | ||||
|         if (randr_major_version < 1 | ||||
|             || (randr_major_version == 1 && randr_minor_version < 5)) { | ||||
|                 fprintf(stderr, "Server RandR version too low (%i.%i). Falling back to single monitor mode\n", | ||||
|                                 randr_major_version, | ||||
|                                 randr_minor_version); | ||||
|                 LOG_W("Server RandR version too low (%i.%i). " | ||||
|                       "Falling back to single monitor mode.", | ||||
|                       randr_major_version, | ||||
|                       randr_minor_version); | ||||
|                 screen_update_fallback(); | ||||
|                 return; | ||||
|         } | ||||
| @ -112,7 +115,8 @@ void randr_update() | ||||
|         XRRMonitorInfo *m = XRRGetMonitors(xctx.dpy, RootWindow(xctx.dpy, DefaultScreen(xctx.dpy)), true, &n); | ||||
| 
 | ||||
|         if (n < 1) { | ||||
|                 fprintf(stderr, "Get monitors reported %i monitors, falling back to single monitor mode\n", n); | ||||
|                 LOG_C("Get monitors reported %i monitors. " | ||||
|                       "Falling back to single monitor mode.", n); | ||||
|                 screen_update_fallback(); | ||||
|                 return; | ||||
|         } | ||||
| @ -150,7 +154,8 @@ void xinerama_update() | ||||
|         XineramaScreenInfo *info = XineramaQueryScreens(xctx.dpy, &n); | ||||
| 
 | ||||
|         if (!info) { | ||||
|                 fprintf(stderr, "(Xinerama) Could not get screen info, falling back to single monitor mode\n"); | ||||
|                 LOG_W("Could not get xinerama screen info. " | ||||
|                       "Falling back to single monitor mode."); | ||||
|                 screen_update_fallback(); | ||||
|                 return; | ||||
|         } | ||||
|  | ||||
							
								
								
									
										20
									
								
								src/x11/x.c
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								src/x11/x.c
									
									
									
									
									
								
							| @ -84,7 +84,7 @@ static color_t x_string_to_color_t(const char *str) | ||||
|         char *end; | ||||
|         long int val = strtol(str+1, &end, 16); | ||||
|         if (*end != '\0' && *(end+1) != '\0') { | ||||
|                 printf("WARNING: Invalid color string: \"%s\"\n", str); | ||||
|                 LOG_W("Invalid color string: '%s'", str); | ||||
|         } | ||||
| 
 | ||||
|         return x_color_hex_to_double(val); | ||||
| @ -133,9 +133,7 @@ static color_t x_get_separator_color(colored_layout *cl, colored_layout *cl_next | ||||
|         case AUTO: | ||||
|                 return calculate_foreground_color(cl->bg); | ||||
|         default: | ||||
|                 printf("Unknown separator color type. Please file a Bugreport.\n"); | ||||
|                 return cl->fg; | ||||
| 
 | ||||
|                 LOG_E("Unknown separator color type."); | ||||
|         } | ||||
| } | ||||
| 
 | ||||
| @ -379,8 +377,7 @@ static GdkPixbuf *get_pixbuf_from_path(char *icon_path) | ||||
|                         } while (*(end) != '\0'); | ||||
|                 } | ||||
|                 if (pixbuf == NULL) { | ||||
|                         fprintf(stderr, | ||||
|                                 "Could not load icon: '%s'\n", icon_path); | ||||
|                         LOG_W("Could not load icon: '%s'", icon_path); | ||||
|                 } | ||||
|                 if (uri_path != NULL) { | ||||
|                         g_free(uri_path); | ||||
| @ -535,7 +532,7 @@ static colored_layout *r_create_layout_from_notification(cairo_t *c, notificatio | ||||
|                 cl->attr = NULL; | ||||
|                 pango_layout_set_text(cl->l, n->text_to_render, -1); | ||||
|                 if (n->first_render) { | ||||
|                         printf("Error parsing markup: %s\n", err->message); | ||||
|                         LOG_W("Unable to parse markup: %s", err->message); | ||||
|                 } | ||||
|                 g_error_free(err); | ||||
|         } | ||||
| @ -1194,7 +1191,7 @@ void x_win_show(void) | ||||
|                     None, | ||||
|                     None); | ||||
|         if (x_shortcut_tear_down_error_handler()) { | ||||
|                 fprintf(stderr, "Unable to grab mouse button(s)\n"); | ||||
|                 LOG_W("Unable to grab mouse button(s)."); | ||||
|         } | ||||
| 
 | ||||
|         XMapRaised(xctx.dpy, xctx.win); | ||||
| @ -1234,7 +1231,7 @@ KeySym x_shortcut_string_to_mask(const char *str) | ||||
|         } else if (!strcmp(str, "shift")) { | ||||
|                 return ShiftMask; | ||||
|         } else { | ||||
|                 fprintf(stderr, "Warning: Unknown Modifier: %s\n", str); | ||||
|                 LOG_W("Unknown Modifier: '%s'", str); | ||||
|                 return 0; | ||||
|         } | ||||
| } | ||||
| @ -1309,7 +1306,7 @@ int x_shortcut_grab(keyboard_shortcut *ks) | ||||
|         } | ||||
| 
 | ||||
|         if (x_shortcut_tear_down_error_handler()) { | ||||
|                 fprintf(stderr, "Unable to grab key \"%s\"\n", ks->str); | ||||
|                 LOG_W("Unable to grab key '%s'.", ks->str); | ||||
|                 ks->is_valid = false; | ||||
|                 return 1; | ||||
|         } | ||||
| @ -1372,8 +1369,7 @@ void x_shortcut_init(keyboard_shortcut *ks) | ||||
|         } | ||||
| 
 | ||||
|         if (ks->sym == NoSymbol || ks->code == NoSymbol) { | ||||
|                 fprintf(stderr, "Warning: Unknown keyboard shortcut: %s\n", | ||||
|                         ks->str); | ||||
|                 LOG_W("Unknown keyboard shortcut: '%s'", ks->str); | ||||
|                 ks->is_valid = false; | ||||
|         } else { | ||||
|                 ks->is_valid = true; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Benedikt Heine
						Benedikt Heine