mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-29 07:53:37 +00:00
Improved server debug functions.
This commit is contained in:
parent
91adc48178
commit
b1a1717fd9
2 changed files with 9 additions and 5 deletions
8
snac.c
8
snac.c
|
@ -39,14 +39,16 @@ d_char *xs_time(char *fmt, int local)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void srv_log(d_char *str)
|
void srv_debug(int level, d_char *str)
|
||||||
/* logs a message */
|
/* logs a debug message */
|
||||||
{
|
{
|
||||||
xs *tm = xs_local_time("%H:%M:%S");
|
|
||||||
xs *msg = str;
|
xs *msg = str;
|
||||||
|
|
||||||
|
if (dbglevel >= level) {
|
||||||
|
xs *tm = xs_local_time("%H:%M:%S");
|
||||||
fprintf(stderr, "%s %s\n", tm, msg);
|
fprintf(stderr, "%s %s\n", tm, msg);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int srv_open(char *basedir)
|
int srv_open(char *basedir)
|
||||||
|
|
4
snac.h
4
snac.h
|
@ -11,6 +11,8 @@ d_char *xs_time(char *fmt, int local);
|
||||||
#define xs_local_time(fmt) xs_time(fmt, 1)
|
#define xs_local_time(fmt) xs_time(fmt, 1)
|
||||||
#define xs_utc_time(fmt) xs_time(fmt, 0)
|
#define xs_utc_time(fmt) xs_time(fmt, 0)
|
||||||
|
|
||||||
void srv_log(d_char *str);
|
void srv_debug(int level, d_char *str);
|
||||||
|
#define srv_log(str) srv_debug(0, str)
|
||||||
|
|
||||||
int srv_open(char *basedir);
|
int srv_open(char *basedir);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue