Browse code

flags.c: logging: convert LOG to LM_*

Ovidiu Sas authored on 04/10/2014 00:20:49
Showing 1 changed files
... ...
@@ -70,13 +70,11 @@ int isflagset( struct sip_msg* msg, flag_t flag ) {
70 70
 
71 71
 int flag_in_range( flag_t flag ) {
72 72
 	if (flag > MAX_FLAG ) {
73
-		LOG(L_ERR, "ERROR: message flag %d too high; MAX=%d\n",
74
-			flag, MAX_FLAG );
73
+		LM_ERR("message flag %d too high; MAX=%d\n", flag, MAX_FLAG );
75 74
 		return 0;
76 75
 	}
77 76
 	if ((int)flag<0) {
78
-		LOG(L_ERR, "ERROR: message flag (%d) must be in range %d..%d\n",
79
-			flag, 0, MAX_FLAG );
77
+		LM_ERR("message flag (%d) must be in range 0..%d\n", flag, MAX_FLAG );
80 78
 		return 0;
81 79
 	}
82 80
 	return 1;
... ...
@@ -152,8 +150,7 @@ int check_flag(int n)
152 152
 	if (!flag_in_range(n))
153 153
 		return -1;
154 154
 	if (registered_flags[n]){
155
-		LOG(L_WARN, "WARNING: check_flag: flag %d is already used by "
156
-					" a named flag\n", n);
155
+		LM_WARN("flag %d is already used by a named flag\n", n);
157 156
 	}
158 157
 	return 0;
159 158
 }
... ...
@@ -219,20 +216,18 @@ int register_flag(char* name, int pos)
219 219
 	/* check if the name already exists */
220 220
 	e=flag_search(&name2flags[h], name, len);
221 221
 	if (e){
222
-		LOG(L_ERR, "ERROR: register_flag: flag %.*s already registered\n",
223
-					len, name);
222
+		LM_ERR("flag %.*s already registered\n", len, name);
224 223
 		return -2;
225 224
 	}
226 225
 	/* check if there is already another flag registered at pos */
227 226
 	if (pos!=-1){
228 227
 		if ((pos<0) || (pos>MAX_FLAG)){
229
-			LOG(L_ERR, "ERROR: register_flag: invalid flag %.*s "
230
-					"position(%d)\n", len, name, pos);
228
+			LM_ERR("invalid flag %.*s position(%d)\n", len, name, pos);
231 229
 			return -4;
232 230
 		}
233 231
 		if (registered_flags[pos]!=0){
234
-			LOG(L_WARN, "WARNING: register_flag:  %.*s:  flag %d already in "
235
-					"use under another name\n", len, name, pos);
232
+			LM_WARN("%.*s:  flag %d already in use under another name\n",
233
+					len, name, pos);
236 234
 			/* continue */
237 235
 		}
238 236
 	}else{
... ...
@@ -246,8 +241,7 @@ int register_flag(char* name, int pos)
246 246
 			}
247 247
 		}
248 248
 		if (pos==-1){
249
-			LOG(L_ERR, "ERROR: register_flag: could not register %.*s"
250
-					" - too many flags\n", len, name);
249
+			LM_ERR("could not register %.*s - too many flags\n", len, name);
251 250
 			return -5;
252 251
 		}
253 252
 	}
... ...
@@ -255,7 +249,7 @@ int register_flag(char* name, int pos)
255 255
 	
256 256
 	e=pkg_malloc(sizeof(struct flag_entry));
257 257
 	if (e==0){
258
-		LOG(L_ERR, "ERROR: register_flag: memory allocation failure\n");
258
+		LM_ERR("memory allocation failure\n");
259 259
 		return -3;
260 260
 	}
261 261
 	e->name.s=name;
... ...
@@ -279,8 +273,7 @@ static int fixup_t_flag(void** param, int param_no)
279 279
 	DBG("DEBUG: fixing flag: %s\n", (char *) (*param));
280 280
 
281 281
 	if (param_no!=1) {
282
-		LOG(L_ERR, "ERROR: TM module: only parameter #1 for flags can be"
283
-					" fixed\n");
282
+		LM_ERR("TM module: only parameter #1 for flags can be fixed\n");
284 283
 		return E_BUG;
285 284
 	};
286 285
 
... ...
@@ -305,7 +298,7 @@ static int fixup_t_flag(void** param, int param_no)
305 305
 		while ( *c && *c>='0' && *c<='9' ) {
306 306
 			*code = *code*10+ *c-'0';
307 307
 			if (*code > (sizeof( flag_t ) * CHAR_BIT - 1 )) {
308
-				LOG(L_ERR, "ERROR: TM module: too big flag number: %s; MAX=%d\n",
308
+				LM_ERR("TM module: too big flag number: %s; MAX=%d\n",
309 309
 					(char *) (*param), sizeof( flag_t ) * CHAR_BIT - 1 );
310 310
 				goto error;
311 311
 			}
... ...
@@ -315,12 +308,12 @@ static int fixup_t_flag(void** param, int param_no)
315 315
 	while ( *c && (*c==' ' || *c=='\t')) c++; /* terminating whitespaces */
316 316
 
317 317
 	if ( *code == 0 ) {
318
-		LOG(L_ERR, "ERROR: TM module: bad flag number: %s\n", (char *) (*param));
318
+		LM_ERR("TM module: bad flag number: %s\n", (char *) (*param));
319 319
 		goto error;
320 320
 	}
321 321
 
322 322
 	if (*code < FL_MAX && token==0) {
323
-		LOG(L_ERR, "ERROR: TM module: too high flag number: %s (%d)\n; lower number"
323
+		LM_ERR("TM module: too high flag number: %s (%d)\n; lower number"
324 324
 			" bellow %d reserved\n", (char *) (*param), *code, FL_MAX );
325 325
 		goto error;
326 326
 	}