Pass flag to logger if it's error

This commit is contained in:
Ludvig Strigeus 2018-10-19 13:40:59 +02:00
parent 0fa4ab3fc8
commit 7b5e1b9717
4 changed files with 6 additions and 6 deletions

View file

@ -840,7 +840,7 @@ bool TunsafeServiceServer::AuthenticateUser() {
return rv;
}
static void PushServiceLine(const char *s) {
static void PushServiceLine(int type, const char *s) {
if (g_service) {
char buf[64];
SYSTEMTIME t;

View file

@ -1061,7 +1061,7 @@ static INT_PTR WINAPI DlgProc(HWND hWnd, UINT message, WPARAM wParam,
return FALSE;
}
void PushLine(const char *s) {
void PushLine(int type, const char *s) {
size_t l = strlen(s);
char buf[64];
SYSTEMTIME t;

View file

@ -244,7 +244,7 @@ void printhex(const char *name, const void *a, size_t l) {
}
#endif
typedef void Logger(const char *msg);
typedef void Logger(int type, const char *msg);
Logger *g_logger;
#undef RERROR
@ -259,7 +259,7 @@ void RERROR(const char *msg, ...) {
vsnprintf(buf, sizeof(buf), msg, va);
va_end(va);
if (g_logger) {
g_logger(buf);
g_logger(1, buf);
} else {
fputs(buf, stderr);
fputs("\n", stderr);
@ -274,7 +274,7 @@ void RINFO(const char *msg, ...) {
vsnprintf(buf, sizeof(buf), msg, va);
va_end(va);
if (g_logger) {
g_logger(buf);
g_logger(0, buf);
} else {
fputs(buf, stderr);
fputs("\n", stderr);

2
util.h
View file

@ -8,7 +8,7 @@ bool base64_decode(uint8 *in, size_t inLen, uint8 *out, size_t *outLen);
bool IsOnlyZeros(const uint8 *data, size_t data_size);
int RunCommand(const char *fmt, ...);
typedef void Logger(const char *msg);
typedef void Logger(int type, const char *msg);
extern Logger *g_logger;