comparison mcabber/src/settings.c @ 374:bd5638c21834

Improve logging system (traces) There are now two trace logging levels: * tracelog_level = 1: Most messages from the log window are written to disk (LPRINT_LOG) * tracelog_level =2: LPRINT_LOG & LPRINT_DEBUG messages are written to disk The trace file name is set with the "tracelog_file" option.
author Mikael Berthe <mikael@lilotux.net>
date Mon, 25 Jul 2005 21:46:35 +0100
parents 33b8e801ffa6
children 2e6c7b1440d1
comparison
equal deleted inserted replaced
373:af2f8ddf6a1b 374:bd5638c21834
76 76
77 if (!filename) { 77 if (!filename) {
78 // Use default config file locations 78 // Use default config file locations
79 char *home = getenv("HOME"); 79 char *home = getenv("HOME");
80 if (!home) { 80 if (!home) {
81 ut_WriteLog("Can't find home dir!\n"); 81 scr_LogPrint(LPRINT_LOG, "Can't find home dir!");
82 fprintf(stderr, "Can't find home dir!\n"); 82 fprintf(stderr, "Can't find home dir!\n");
83 return -1; 83 return -1;
84 } 84 }
85 filename = g_new(char, strlen(home)+24); 85 filename = g_new(char, strlen(home)+24);
86 sprintf(filename, "%s/.mcabber/mcabberrc", home); 86 sprintf(filename, "%s/.mcabber/mcabberrc", home);
136 if ((strchr(line, '=') != NULL)) { 136 if ((strchr(line, '=') != NULL)) {
137 // Only accept the set, alias and bind commands 137 // Only accept the set, alias and bind commands
138 if (strncmp(line, "set ", 4) && 138 if (strncmp(line, "set ", 4) &&
139 strncmp(line, "bind ", 5) && 139 strncmp(line, "bind ", 5) &&
140 strncmp(line, "alias ", 6)) { 140 strncmp(line, "alias ", 6)) {
141 scr_LogPrint("Error in configuration file (l. %d): bad command", ln); 141 scr_LogPrint(LPRINT_LOGNORM,
142 "Error in configuration file (l. %d): bad command", ln);
142 err++; 143 err++;
143 continue; 144 continue;
144 } 145 }
145 *(--line) = '/'; // Set the leading '/' to build a command line 146 *(--line) = '/'; // Set the leading '/' to build a command line
146 process_command(line); // Process the command 147 process_command(line); // Process the command
147 } else { 148 } else {
148 scr_LogPrint("Error in configuration file (l. %d): no assignment", ln); 149 scr_LogPrint(LPRINT_LOGNORM,
150 "Error in configuration file (l. %d): no assignment", ln);
149 err++; 151 err++;
150 } 152 }
151 } 153 }
152 g_free(buf); 154 g_free(buf);
153 fclose(fp); 155 fclose(fp);