Ignore:
Timestamp:
Feb 12, 2007, 10:54:22 AM (17 years ago)
Author:
Bruno Cornec
Message:

log_trace (unused) and log_trace_msg removed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mondo/src/common/libmondo-tools.c

    r1140 r1144  
    314314#endif
    315315}
    316 
    317 
    318 /**
    319  * Log a trace message to the trace file.
    320  * @bug This function seems orphaned. Please remove.
    321  */
    322 void log_trace(char *o)
    323 {
    324     /*@ pointers **************************************************** */
    325     FILE *fout;
    326 
    327     /*@ buffers ***************************************************** */
    328     char output[MAX_STR_LEN];
    329 
    330     /*@ int    ****************************************************** */
    331     int i;
    332 
    333     /*@ end vars *************************************************** */
    334 
    335     if (o[0] == '\0') {
    336         return;
    337     }
    338     strcpy(output, o);
    339     i = (int) strlen(output);
    340     if (i <= 0) {
    341         return;
    342     }
    343     if (output[i - 1] < 32) {
    344         output[i - 1] = '\0';
    345     }
    346     if (g_text_mode
    347         /* && !strstr(last_line_of_file(MONDO_LOGFILE),output) */ ) {
    348         printf("%s\n", output);
    349     }
    350 
    351     fout = fopen(MONDO_TRACEFILE, "a");
    352     if (fout) {
    353         fprintf(fout, "%s\n", output);
    354         paranoid_fclose(fout);
    355     } else {
    356         log_OS_error("Cannot write to tracefile");
    357     }
    358 }
    359 
    360 
    361 
    362316
    363317
     
    13341288
    13351289/**
    1336  * The standard log_debug_msg() (mr_msg() also due to a macro). Writes some describing
    1337  * information to the logfile.
    1338  */
    1339 void standard_log_debug_msg(int debug_level, const char *szFile,
    1340                             const char *szFunction, int nLine,
    1341                             const char *fmt, ...)
    1342 {
    1343     va_list args;
    1344     int i;
    1345     static int depth = 0;
    1346     char *tmp;
    1347     FILE *fout;
    1348 
    1349     if (depth > 5) {
    1350         depth--;
    1351         return;
    1352     }
    1353     depth++;
    1354 
    1355     malloc_string(tmp);
    1356 
    1357     if (debug_level <= g_loglevel) {
    1358         va_start(args, fmt);
    1359         if (!(fout = fopen(MONDO_LOGFILE, "a"))) {
    1360             return;
    1361         }                       // fatal_error("Failed to openout to logfile - sheesh..."); }
    1362 
    1363         // add tabs to distinguish log levels
    1364         if (debug_level > 0) {
    1365             for (i = 1; i < debug_level; i++)
    1366                 fprintf(fout, "\t");
    1367             if (getpid() == g_main_pid)
    1368                 fprintf(fout, "[Main] %s->%s#%d: ", szFile, szFunction,
    1369                         nLine);
    1370             else if (getpid() == g_buffer_pid && g_buffer_pid > 0)
    1371                 fprintf(fout, "[Buff] %s->%s#%d: ", szFile, szFunction,
    1372                         nLine);
    1373             else
    1374                 fprintf(fout, "[TH=%d] %s->%s#%d: ", getpid(), szFile,
    1375                         szFunction, nLine);
    1376         }
    1377         vfprintf(fout, fmt, args);
    1378 
    1379         // do not slow down the progran if standard debug level
    1380         // must be enabled: if no flush, the log won't be up-to-date if there
    1381         // is a segfault
    1382         //if (g_dwDebugLevel != 1)
    1383 
    1384         va_end(args);
    1385         fprintf(fout, "\n");
    1386         paranoid_fclose(fout);
    1387     }
    1388     depth--;
    1389     mr_free(tmp);
    1390 }
    1391 
    1392 /**
    1393  * Function pointer to the @c log_debug_msg function to use. Points to standard_log_debug_msg() by default.
    1394  */
    1395 void (*log_debug_msg) (int, const char *, const char *, int, const char *,
    1396                        ...) = standard_log_debug_msg;
    1397 
    1398 
    1399 /**
    14001290 * If @p y, malloc @p x, else free @p x.
    14011291 * @bug This function seems orphaned. Please remove.
     
    14261316        mr_free(g_magicdev_command);
    14271317    }
    1428 
    1429     /*
    1430        char**list_of_arrays[] = {
    1431        &g_boot_mountpt,
    1432        &g_mondo_home,
    1433        &g_tmpfs_mountpt,
    1434        &g_erase_tmpdir_and_scratchdir,
    1435        &g_serial_string,
    1436        &g_magicdev_command,
    1437        NULL};
    1438 
    1439        char**ppcurr;
    1440        int i;
    1441 
    1442        for(i=0;list_of_arrays[i];i++)
    1443        {
    1444        mr_msg(5, "Allocating %d", i);
    1445        ppcurr = list_of_arrays[i];
    1446        if (mal)
    1447        { *ppcurr = malloc(MAX_STR_LEN); }
    1448        else
    1449        {
    1450        if (*ppcurr)
    1451        {
    1452        free(*ppcurr);
    1453        }
    1454        }
    1455        }
    1456        mr_msg(5, "Returning");
    1457      */
    14581318}
    14591319
Note: See TracChangeset for help on using the changeset viewer.