mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-30 01:48:54 +00:00
Add logString() function
This commit is contained in:
parent
2bd7c38483
commit
560e0c6699
19
log.c
19
log.c
@ -216,6 +216,25 @@ void logArgv(int level, const char *file, unsigned int line, const char *functio
|
||||
}
|
||||
}
|
||||
|
||||
void logString(int level, const char *file, unsigned int line, const char *function, const char *str)
|
||||
{
|
||||
const char *s = str;
|
||||
const char *p;
|
||||
for (p = str; *p; ++p) {
|
||||
if (*p == '\n') {
|
||||
if (_log_prepare(level, file, line, function)) {
|
||||
strbuf_ncat(&logbuf, str, p - s);
|
||||
_log_finish(level);
|
||||
}
|
||||
s = p + 1;
|
||||
}
|
||||
}
|
||||
if (p > s && _log_prepare(level, file, line, function)) {
|
||||
strbuf_ncat(&logbuf, str, p - s);
|
||||
_log_finish(level);
|
||||
}
|
||||
}
|
||||
|
||||
void logMessage(int level, const char *file, unsigned int line, const char *function, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
1
log.h
1
log.h
@ -63,6 +63,7 @@ void set_logging(FILE *f);
|
||||
FILE *open_logging();
|
||||
void close_logging();
|
||||
void logArgv(int level, const char *file, unsigned int line, const char *function, const char *label, int argc, const char *const *argv);
|
||||
void logString(int level, const char *file, unsigned int line, const char *function, const char *str);
|
||||
void logMessage(int level, const char *file, unsigned int line, const char *function, const char *fmt, ...);
|
||||
void vlogMessage(int level, const char *file, unsigned int line, const char *function, const char *fmt, va_list);
|
||||
unsigned int debugFlagMask(const char *flagname);
|
||||
|
Loading…
Reference in New Issue
Block a user