Skip to content

Commit e192b69

Browse files
committed
rwrap: Add NOTICE as log level
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
1 parent c7777b9 commit e192b69

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

src/resolv_wrapper.c

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
enum rwrap_dbglvl_e {
7979
RWRAP_LOG_ERROR = 0,
8080
RWRAP_LOG_WARN,
81+
RWRAP_LOG_NOTICE,
8182
RWRAP_LOG_DEBUG,
8283
RWRAP_LOG_TRACE
8384
};
@@ -94,6 +95,7 @@ static void rwrap_log(enum rwrap_dbglvl_e dbglvl,
9495
const char *d;
9596
unsigned int lvl = 0;
9697
int pid = getpid();
98+
const char *prefix = NULL;
9799

98100
d = getenv("RESOLV_WRAPPER_DEBUGLEVEL");
99101
if (d != NULL) {
@@ -110,26 +112,28 @@ static void rwrap_log(enum rwrap_dbglvl_e dbglvl,
110112

111113
switch (dbglvl) {
112114
case RWRAP_LOG_ERROR:
113-
fprintf(stderr,
114-
"RWRAP_ERROR(%d) - %s: %s\n",
115-
pid, func, buffer);
115+
prefix = "RWRAP_ERROR";
116116
break;
117117
case RWRAP_LOG_WARN:
118-
fprintf(stderr,
119-
"RWRAP_WARN(%d) - %s: %s\n",
120-
pid, func, buffer);
118+
prefix = "RWRAP_WARN";
119+
break;
120+
case RWRAP_LOG_NOTICE:
121+
prefix = "RWRAP_NOTICE";
121122
break;
122123
case RWRAP_LOG_DEBUG:
123-
fprintf(stderr,
124-
"RWRAP_DEBUG(%d) - %s: %s\n",
125-
pid, func, buffer);
124+
prefix = "RWRAP_DEBUG";
126125
break;
127126
case RWRAP_LOG_TRACE:
128-
fprintf(stderr,
129-
"RWRAP_TRACE(%d) - %s: %s\n",
130-
pid, func, buffer);
127+
prefix = "RWRAP_TRACE";
131128
break;
132129
}
130+
131+
fprintf(stderr,
132+
"%s(%d) - %s: %s\n",
133+
prefix,
134+
pid,
135+
func,
136+
buffer);
133137
}
134138

135139
#ifndef SAFE_FREE

0 commit comments

Comments
 (0)