Changeset 2289 for trunk/oscam-log.c
- Timestamp:
- 05/16/10 23:33:22 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/oscam-log.c
r2233 r2289 2 2 #include <syslog.h> 3 3 #include <stdlib.h> 4 #include <pthread.h>5 4 6 5 int number_of_chars_printed = 0; … … 10 9 static int use_syslog=0; 11 10 static int use_stdout=0; 12 static pthread_mutex_t log_lock;13 11 static char *log_txt; 14 12 static char *log_buf; … … 82 80 static char *head = ">> OSCam << cardserver started version " CS_VERSION ", build #" CS_SVN_VERSION " (" CS_OSTYPE ")"; 83 81 84 pthread_mutex_init(&log_lock, NULL);85 82 log_txt = malloc(512); 86 83 log_buf = malloc(700); … … 221 218 if (!log_txt) 222 219 return; 223 pthread_mutex_lock(&log_lock);224 220 get_log_header(1, log_txt); 225 221 va_list params; … … 228 224 va_end(params); 229 225 write_to_log(-1, log_txt); 230 pthread_mutex_unlock(&log_lock);231 226 } 232 227 … … 235 230 if (log_txt) { 236 231 cs_log("LOG CLOSED"); 237 pthread_mutex_destroy(&log_lock);238 232 free(log_buf); 239 233 free(log_txt); … … 251 245 if (log_txt && client[cs_idx].dbglvl & cs_ptyp) 252 246 { 253 pthread_mutex_lock(&log_lock);254 247 get_log_header(1, log_txt); 255 248 va_list params; … … 258 251 va_end(params); 259 252 write_to_log(-1, log_txt); 260 pthread_mutex_unlock(&log_lock);261 253 } 262 254 } … … 266 258 if (log_txt && client[cs_idx].dbglvl & mask) 267 259 { 268 pthread_mutex_lock(&log_lock);269 260 get_log_header(1, log_txt); 270 261 va_list params; … … 273 264 va_end(params); 274 265 write_to_log(-1, log_txt); 275 pthread_mutex_unlock(&log_lock);276 266 } 277 267 } … … 281 271 if (log_txt && client[cs_idx].dbglvl & cs_ptyp) 282 272 { 283 pthread_mutex_lock(&log_lock);284 273 va_list params; 285 274 va_start(params, fmt); … … 292 281 number_of_chars_printed++; 293 282 write_to_log(number_of_chars_printed, log_txt); 294 pthread_mutex_unlock(&log_lock);295 283 } 296 284 } … … 300 288 if (!log_txt) 301 289 return; 302 pthread_mutex_lock(&log_lock);303 290 int i; 304 291 … … 320 307 write_to_log(-1, log_txt); 321 308 } 322 pthread_mutex_unlock(&log_lock);323 309 } 324 310 … … 327 313 if (!log_txt) 328 314 return; 329 pthread_mutex_lock(&log_lock);330 315 int i; 331 316 … … 351 336 } 352 337 } 353 pthread_mutex_unlock(&log_lock);354 338 } 355 339 … … 358 342 if(!log_txt) 359 343 return; 360 pthread_mutex_lock(&log_lock);361 344 int i; 362 345 … … 382 365 } 383 366 } 384 pthread_mutex_unlock(&log_lock);385 367 } 386 368
Note:
See TracChangeset
for help on using the changeset viewer.