mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-22 05:15:04 +00:00
New functions snac_debug() and snac_log().
This commit is contained in:
parent
32c188ae8f
commit
1ad66e5166
3 changed files with 16 additions and 0 deletions
1
main.c
1
main.c
|
@ -14,6 +14,7 @@ int main(int argc, char *argv[])
|
|||
srv_open("/home/angel/lib/snac/comam.es");
|
||||
|
||||
snac_open(&snac, "mike");
|
||||
snac_log(&snac, xs_str_new("ok"));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
12
snac.c
12
snac.c
|
@ -199,3 +199,15 @@ void snac_free(snac *snac)
|
|||
free(snac->key);
|
||||
free(snac->actor);
|
||||
}
|
||||
|
||||
|
||||
void snac_debug(snac *snac, int level, d_char *str)
|
||||
/* prints a user debugging information */
|
||||
{
|
||||
xs *msg = str;
|
||||
|
||||
if (dbglevel >= level) {
|
||||
xs *tm = xs_local_time("%H:%M:%S");
|
||||
fprintf(stderr, "%s [%s] %s\n", tm, snac->uid, msg);
|
||||
}
|
||||
}
|
||||
|
|
3
snac.h
3
snac.h
|
@ -28,3 +28,6 @@ typedef struct _snac {
|
|||
|
||||
int snac_open(snac *snac, char *uid);
|
||||
void snac_free(snac *snac);
|
||||
|
||||
void snac_debug(snac *snac, int level, d_char *str);
|
||||
#define snac_log(snac, str) snac_debug(snac, 0, str)
|
||||
|
|
Loading…
Reference in a new issue