X-Git-Url: http://git.wpitchoune.net/gitweb/?a=blobdiff_plain;f=src%2Fnote.c;h=f5e3a91d2b3bc81ef8f715fa1e66f5d0dc4bc273;hb=ce7497e25edfc10304e38edbf206566ad4548dee;hp=c5b225a563b519cd080df6d631caee4766b522ea;hpb=2306c86fb2ec18c15e04a7373f28c8b438d78271;p=ptask.git diff --git a/src/note.c b/src/note.c index c5b225a..f5e3a91 100644 --- a/src/note.c +++ b/src/note.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2012 jeanfi@gmail.com + * Copyright (C) 2012-2013 jeanfi@gmail.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -23,6 +23,7 @@ #include #include +#include #include static char *get_path(const char *uuid) @@ -32,7 +33,7 @@ static char *get_path(const char *uuid) home = getenv("HOME"); if (!home) { - fprintf(stderr, "HOME environment variable not defined\n"); + log_err("HOME environment variable not defined"); return NULL; } @@ -58,7 +59,7 @@ void note_put(const char *uuid, const char *note) if (!path) return ; - printf("note_put %s %s %s\n", path, uuid, note); + log_debug("note_put %s %s %s", path, uuid, note); f = fopen(path, "w"); @@ -66,7 +67,7 @@ void note_put(const char *uuid, const char *note) fwrite(note, 1, strlen(note), f); fclose(f); } else { - fprintf(stderr, "Failed to open %s\n", path); + log_err("Failed to open %s", path); } free(path); @@ -99,7 +100,7 @@ char *note_get(const char *uuid) } fclose(f); } else { - fprintf(stderr, "Failed to open %s\n", path); + log_debug("%s does not exist or cannot be opened", path); } return str;