commit c53ce228e2a4326fb743c13159fb17d8b0fc557f
parent 000c4c1402b1029617451ce0bb74b3fcdacc39ca
Author: nibo <nibo@relim.de>
Date: Mon, 30 Jun 2025 17:30:43 +0200
Improve logging a bit
Diffstat:
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/chordpro.c b/src/chordpro.c
@@ -4694,7 +4694,7 @@ cho_attrs_get(struct Attr **attrs, const char *name)
return NULL;
}
-/* TODO: Only providing a label name like '{sog: Interlude}' is currently an error */
+/* TODO: Only providing a label name like '{sog: Interlude}' is an error according to how I understand the spec. */
static bool
cho_grid_shape_parse_and_set(struct ChoContext *ctx, const char *str)
{
@@ -4740,7 +4740,8 @@ cho_grid_shape_parse_and_set(struct ChoContext *ctx, const char *str)
break;
}
if (t > 5) {
- cho_log(ctx, LOG_ERR, "");
+ cho_log(ctx, LOG_ERR, "Failed to parse the grid shape '%s'.", str);
+ return false;
}
tmp[t] = *c;
t++;
diff --git a/src/lorid.c b/src/lorid.c
@@ -21,6 +21,7 @@ main(int argc, char *argv[])
{ 0, 0, 0, 0 }
};
int o, option_index;
+ int s = 0;
const char *chordpro_filepath = NULL;
char *config_filepath = NULL;
char *output = NULL;
@@ -29,8 +30,8 @@ main(int argc, char *argv[])
struct ChoSong **songs = NULL;
struct ChoSong **so;
struct Config *config;
- int s = 0;
FILE *fp;
+
while ((o = getopt_long(argc, argv, "pc:o:Vvh", long_options, &option_index)) != -1) {
switch(o) {
case 'p':
@@ -73,7 +74,7 @@ main(int argc, char *argv[])
snprintf(default_config_path, size, "%s/.config/lorid/config.toml", home);
config = config_load_from_file(default_config_path);
if (!config) {
- printf("Loading default config instead of reading from a file.\n");
+ util_log(NULL, 0, LOG_INFO, "Loading default config instead of reading from a file.");
config = config_load_default();
}
}
@@ -131,7 +132,7 @@ main(int argc, char *argv[])
qsort(all_songs, cho_song_count(all_songs), sizeof(struct ChoSong *), cho_song_compare);
pdf_filename = out_pdf_create(chordpro_filepath, output, all_songs, config);
if (!pdf_filename) {
- LOG_DEBUG("out_pdf_new failed.");
+ LOG_DEBUG("out_pdf_create failed.");
return 1;
}
util_log(NULL, 0, LOG_INFO, "Writing pdf to file: '%s'.", pdf_filename);