Changeset 1144


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

log_trace (unused) and log_trace_msg removed

Location:
branches/stable/mondo/src
Files:
4 edited

Legend:

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

    r1102 r1144  
    66extern void clean_up_KDE_desktop_if_necessary(void);
    77extern long get_time(void);
    8 extern void (*log_debug_msg) (int debug_level, const char *szFile,
    9                               const char *szFunction, int nLine,
    10                               const char *fmt, ...);
    11 extern void standard_log_debug_msg(int debug_level, const char *szFile,
    12                                    const char *szFunction, int nLine,
    13                                    const char *fmt, ...);
    148extern int read_cfg_var(char *config_file, char *label, char *value);
    159extern int write_cfg_var(char *config_file, char *label, char *value);
     
    2014extern void initialize_raidrec(struct raid_device_record *raidrec);
    2115#endif
    22 extern void log_trace(char *o);
    2316extern int some_basic_system_sanity_checks(void);
    2417
  • 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
  • branches/stable/mondo/src/common/libmondo-tools.h

    r1103 r1144  
    99
    1010long get_time(void);
    11 extern void (*log_debug_msg) (int debug_level, const char *szFile,
    12                               const char *szFunction, int nLine,
    13                               const char *fmt, ...);
    14 void standard_log_debug_msg(int debug_level, const char *szFile,
    15                             const char *szFunction, int nLine,
    16                             const char *fmt, ...);
    1711int read_cfg_var(char *config_file, char *label, char *value);
    1812int write_cfg_var(char *config_file, char *label, char *value);
     
    2317void initialize_raidrec(struct raid_device_record *raidrec);
    2418#endif
    25 void log_trace(char *o);
    2619int some_basic_system_sanity_checks(void);
    2720
  • branches/stable/mondo/src/include/my-stuff.h

    r1131 r1144  
    2626#include <stdio.h>
    2727#include "mr_mem.h"
     28#include "mr_msg.h"
    2829
    2930#if !defined(bool) && !defined(__cplusplus)
     
    100101 */
    101102#define MDSTAT_FILE "/proc/mdstat"
    102 
    103 /**
    104  * @bug Apparently unused.
    105  */
    106 #define MONDO_TRACEFILE "/var/log/mondo-tracefile.log"
    107103
    108104#undef assert
     
    245241 * Log the file, line, Mondo error message, and OS error message (errno).
    246242 */
    247 #define log_OS_error(x) {log_msg(0, "%s, line %ld: %s (%s)", __FILE__, __LINE__, x, strerror(errno));}
     243#define log_OS_error(x) {mr_msg(1, "%s, line %ld: %s (%s)", __FILE__, __LINE__, x, strerror(errno));}
    248244
    249245/**
     
    255251 * close() @p x and log a message if it fails.
    256252 */
    257 #define paranoid_close(x) {if(close(x)) {log_msg(5, "close err");} x=-999; }
     253#define paranoid_close(x) {if(close(x)) {mr_msg(5, "close err");} x=-999; }
    258254
    259255/**
    260256 * fclose() @p x and log a message if it fails.
    261257 */
    262 #define paranoid_fclose(x) {if(fclose(x)) {log_msg(5, "fclose err");} x=NULL; }
     258#define paranoid_fclose(x) {if(fclose(x)) {mr_msg(5, "fclose err");} x=NULL; }
    263259
    264260/**
    265261 * pclose() @p x and log a message if it fails.
    266262 */
    267 #define paranoid_pclose(x) {if(pclose(x)) {log_msg(5, "pclose err");} x=NULL; }
     263#define paranoid_pclose(x) {if(pclose(x)) {mr_msg(5, "pclose err");} x=NULL; }
    268264
    269265/**
    270266 * Run the command @p x and log it if it fails.
    271267 */
    272 #define paranoid_system(x) {if(system(x)) log_msg(4, x); }
     268#define paranoid_system(x) {if(system(x)) mr_msg(4, x); }
    273269
    274270/**
     
    354350
    355351/**
    356  * Compatibility define to change log_it() calls to log_debug_msg() calls.
    357  */
    358 #define log_it(format, args...) log_debug_msg(2, __FILE__, __FUNCTION__, __LINE__, format, ## args)
    359 
    360 /**
    361  * Macro to log a message along with file, line, and function information.
    362  */
    363 #define log_msg(level, format, args...) log_debug_msg(level, __FILE__, __FUNCTION__, __LINE__, format, ## args)
     352 * Shorter log command
     353 */
     354#define log_it(format, args...) mr_msg(2, format, ## args)
    364355
    365356#define DEFAULT_DVD_DISK_SIZE 4380  ///< The default size (in MB) of a DVD disk, unless the user says otherwise.
Note: See TracChangeset for help on using the changeset viewer.