Changeset 1065 in MondoRescue for branches/stable/mondo/src/lib
- Timestamp:
- Jan 23, 2007, 3:48:48 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mondo/src/lib/mr_msg.c
r1064 r1065 20 20 static char *mr_logfile = NULL; 21 21 22 /* 23 * This function is in the lowest part of the tree 24 * It should not depend on any other function of the mr lib 25 */ 26 22 27 /* Cleanup function for messages */ 23 28 void mr_msg_close(void) { 24 29 free(mr_logfile); 25 30 mr_logfile = NULL; 31 mr_loglevel = 0; 26 32 } 27 33 … … 47 53 * but through other functions 48 54 */ 49 void _mr_msg(int debug, const char *file, const char *function, int line, const char *fmt, ...) {55 void mr_msg(int debug, const char *fmt, ...) { 50 56 51 57 int i = 0; … … 63 69 return; 64 70 } 65 va_start(args,fmt);66 71 67 72 // add 2 spaces to distinguish log levels … … 69 74 for (i = 1; i < debug; i++) 70 75 fprintf(fout, " "); 71 fprintf(fout, "%s->%s#%d: ", file, function, line);76 fprintf(fout, "%s->%s#%d: ", __FILE__, __FUNCTION__, __LINE__); 72 77 } 78 va_start(args,fmt); 73 79 if (vfprintf(fout, fmt, args) < 0) { 74 80 fprintf(stderr,"Unable to print to %s\n",mr_logfile); 75 81 } 82 va_end(args); 76 83 77 fprintf(fout, "\n");78 84 if ((res = fclose(fout)) != 0) { 79 85 fprintf(stderr,"Unable to close %s\n",mr_logfile); 80 86 } 81 va_end(args);82 87 } 83 88 } 84 85 void mr_msg(int level, const char *fmt, ...) {86 87 va_list args;88 89 va_start(args,fmt);90 _mr_msg(level, __FILE__, __FUNCTION__, __LINE__, fmt, args);91 va_end(args);92 }
Note:
See TracChangeset
for help on using the changeset viewer.