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 150
 	if (!flag_in_range(n))
153 151
 		return -1;
154 152
 	if (registered_flags[n]){
155
-		LOG(L_WARN, "WARNING: check_flag: flag %d is already used by "
156
-					" a named flag\n", n);
153
+		LM_WARN("flag %d is already used by a named flag\n", n);
157 154
 	}
158 155
 	return 0;
159 156
 }
... ...
@@ -219,20 +216,18 @@ int register_flag(char* name, int pos)
219 216
 	/* check if the name already exists */
220 217
 	e=flag_search(&name2flags[h], name, len);
221 218
 	if (e){
222
-		LOG(L_ERR, "ERROR: register_flag: flag %.*s already registered\n",
223
-					len, name);
219
+		LM_ERR("flag %.*s already registered\n", len, name);
224 220
 		return -2;
225 221
 	}
226 222
 	/* check if there is already another flag registered at pos */
227 223
 	if (pos!=-1){
228 224
 		if ((pos<0) || (pos>MAX_FLAG)){
229
-			LOG(L_ERR, "ERROR: register_flag: invalid flag %.*s "
230
-					"position(%d)\n", len, name, pos);
225
+			LM_ERR("invalid flag %.*s position(%d)\n", len, name, pos);
231 226
 			return -4;
232 227
 		}
233 228
 		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);
229
+			LM_WARN("%.*s:  flag %d already in use under another name\n",
230
+					len, name, pos);
236 231
 			/* continue */
237 232
 		}
238 233
 	}else{
... ...
@@ -246,8 +241,7 @@ int register_flag(char* name, int pos)
246 241
 			}
247 242
 		}
248 243
 		if (pos==-1){
249
-			LOG(L_ERR, "ERROR: register_flag: could not register %.*s"
250
-					" - too many flags\n", len, name);
244
+			LM_ERR("could not register %.*s - too many flags\n", len, name);
251 245
 			return -5;
252 246
 		}
253 247
 	}
... ...
@@ -255,7 +249,7 @@ int register_flag(char* name, int pos)
255 249
 	
256 250
 	e=pkg_malloc(sizeof(struct flag_entry));
257 251
 	if (e==0){
258
-		LOG(L_ERR, "ERROR: register_flag: memory allocation failure\n");
252
+		LM_ERR("memory allocation failure\n");
259 253
 		return -3;
260 254
 	}
261 255
 	e->name.s=name;
... ...
@@ -279,8 +273,7 @@ static int fixup_t_flag(void** param, int param_no)
279 273
 	DBG("DEBUG: fixing flag: %s\n", (char *) (*param));
280 274
 
281 275
 	if (param_no!=1) {
282
-		LOG(L_ERR, "ERROR: TM module: only parameter #1 for flags can be"
283
-					" fixed\n");
276
+		LM_ERR("TM module: only parameter #1 for flags can be fixed\n");
284 277
 		return E_BUG;
285 278
 	};
286 279
 
... ...
@@ -305,7 +298,7 @@ static int fixup_t_flag(void** param, int param_no)
305 298
 		while ( *c && *c>='0' && *c<='9' ) {
306 299
 			*code = *code*10+ *c-'0';
307 300
 			if (*code > (sizeof( flag_t ) * CHAR_BIT - 1 )) {
308
-				LOG(L_ERR, "ERROR: TM module: too big flag number: %s; MAX=%d\n",
301
+				LM_ERR("TM module: too big flag number: %s; MAX=%d\n",
309 302
 					(char *) (*param), sizeof( flag_t ) * CHAR_BIT - 1 );
310 303
 				goto error;
311 304
 			}
... ...
@@ -315,12 +308,12 @@ static int fixup_t_flag(void** param, int param_no)
315 308
 	while ( *c && (*c==' ' || *c=='\t')) c++; /* terminating whitespaces */
316 309
 
317 310
 	if ( *code == 0 ) {
318
-		LOG(L_ERR, "ERROR: TM module: bad flag number: %s\n", (char *) (*param));
311
+		LM_ERR("TM module: bad flag number: %s\n", (char *) (*param));
319 312
 		goto error;
320 313
 	}
321 314
 
322 315
 	if (*code < FL_MAX && token==0) {
323
-		LOG(L_ERR, "ERROR: TM module: too high flag number: %s (%d)\n; lower number"
316
+		LM_ERR("TM module: too high flag number: %s (%d)\n; lower number"
324 317
 			" bellow %d reserved\n", (char *) (*param), *code, FL_MAX );
325 318
 		goto error;
326 319
 	}