This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Defines | |
| #define | panic gw_panic |
Enumerations | |
| enum | output_level { GW_DEBUG, GW_INFO, GW_WARNING, GW_ERROR, GW_PANIC } |
| enum | excl_state { GW_NON_EXCL, GW_EXCL } |
Functions | |
| void | log_init (void) |
| void | log_shutdown (void) |
| void | gw_panic (int, const char *,...) PRINTFLIKE(2 |
| void | error (int, const char *,...) PRINTFLIKE(2 |
| void | warning (int, const char *,...) PRINTFLIKE(2 |
| void | info (int, const char *,...) PRINTFLIKE(2 |
| void | debug (const char *, int, const char *,...) PRINTFLIKE(3 |
| void | log_set_debug_places (const char *places) |
| void | log_set_output_level (enum output_level level) |
| void | log_set_log_level (enum output_level level) |
| void | log_set_syslog (const char *ident, int syslog_level) |
| int | log_open (char *filename, int level, enum excl_state excl) |
| void | log_reopen (void) |
| void | log_close_all (void) |
| void | log_thread_to (unsigned int idx) |
|
|
|
Definition at line 73 of file log.h. 00073 {
00074 GW_NON_EXCL, GW_EXCL
00075 };
|
|
|
Definition at line 68 of file log.h. 00068 {
00069 GW_DEBUG, GW_INFO, GW_WARNING, GW_ERROR, GW_PANIC
00070 };
|
|
||||||||||||||||||||
|
||||||||||||||||
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
Definition at line 273 of file log.c. References dosyslog, file, gw_rwlock_unlock(), gw_rwlock_wrlock(), logfiles, num_logfiles, and rwlock. Referenced by get_and_set_debugs(), log_shutdown(), and main(). 00274 {
00275 /*
00276 * Writer lock.
00277 */
00278 gw_rwlock_wrlock(&rwlock);
00279
00280 while (num_logfiles > 0) {
00281 --num_logfiles;
00282 if (logfiles[num_logfiles].file != stderr &&
00283 logfiles[num_logfiles].file != NULL)
00284 fclose(logfiles[num_logfiles].file);
00285 logfiles[num_logfiles].file = NULL;
00286 }
00287
00288 /*
00289 * Unlock writer.
00290 */
00291 gw_rwlock_unlock(&rwlock);
00292
00293 /* close syslog if used */
00294 if (dosyslog) {
00295 closelog();
00296 dosyslog = 0;
00297 }
00298 }
|
Here is the call graph for this function:

|
|
Definition at line 167 of file log.c. References add_stderr(), gw_rwlock_init_static(), rwlock, and thread_to. Referenced by gwlib_init(). 00168 {
00169 unsigned long i;
00170
00171 /* Initialize rwlock */
00172 gw_rwlock_init_static(&rwlock);
00173
00174 /* default all possible thread to logging index 0, stderr */
00175 for (i = 0; i <= THREADTABLE_SIZE; i++) {
00176 thread_to[i] = 0;
00177 }
00178
00179 add_stderr();
00180 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 301 of file log.c. References error(), filename, gw_rwlock_unlock(), gw_rwlock_wrlock(), info(), logfiles, num_logfiles, and rwlock. Referenced by get_and_set_debugs(), init_bearerbox(), init_smsbox(), init_wapbox(), main(), and smscconn_create(). 00302 {
00303 FILE *f = NULL;
00304 int i;
00305
00306 gw_rwlock_wrlock(&rwlock);
00307
00308 if (num_logfiles == MAX_LOGFILES) {
00309 gw_rwlock_unlock(&rwlock);
00310 error(0, "Too many log files already open, not adding `%s'",
00311 filename);
00312 return -1;
00313 }
00314
00315 if (strlen(filename) > FILENAME_MAX) {
00316 gw_rwlock_unlock(&rwlock);
00317 error(0, "Log filename too long: `%s'.", filename);
00318 return -1;
00319 }
00320
00321 /*
00322 * Check if the file is already opened for logging.
00323 * If there is an open file, then assign the file descriptor
00324 * that is already existing for this log file.
00325 */
00326 for (i = 0; i < num_logfiles && f == NULL; ++i) {
00327 if (strcmp(logfiles[i].filename, filename) == 0)
00328 f = logfiles[i].file;
00329 }
00330
00331 /* if not previously opened, then open it now */
00332 if (f == NULL) {
00333 f = fopen(filename, "a");
00334 if (f == NULL) {
00335 gw_rwlock_unlock(&rwlock);
00336 error(errno, "Couldn't open logfile `%s'.", filename);
00337 return -1;
00338 }
00339 }
00340
00341 logfiles[num_logfiles].file = f;
00342 logfiles[num_logfiles].minimum_output_level = level;
00343 logfiles[num_logfiles].exclusive = excl;
00344 strcpy(logfiles[num_logfiles].filename, filename);
00345 ++num_logfiles;
00346 i = num_logfiles - 1;
00347 gw_rwlock_unlock(&rwlock);
00348
00349 info(0, "Added logfile `%s' with level `%d'.", filename, level);
00350
00351 return i;
00352 }
|
Here is the call graph for this function:

|
|
Definition at line 229 of file log.c. References error(), file, filename, gw_rwlock_unlock(), gw_rwlock_wrlock(), logfiles, and rwlock. Referenced by main(), and signal_handler(). 00230 {
00231 int i, j, found;
00232
00233 /*
00234 * Writer lock.
00235 */
00236 gw_rwlock_wrlock(&rwlock);
00237
00238 for (i = 0; i < num_logfiles; ++i) {
00239 if (logfiles[i].file != stderr) {
00240 found = 0;
00241
00242 /*
00243 * Reverse seek for allready reopened logfile.
00244 * If we find a previous file descriptor for the same file
00245 * name, then don't reopen that duplicate, but assign the
00246 * file pointer to it.
00247 */
00248 for (j = i-1; j >= 0 && found == 0; j--) {
00249 if (strcmp(logfiles[i].filename, logfiles[j].filename) == 0) {
00250 logfiles[i].file = logfiles[j].file;
00251 found = 1;
00252 }
00253 }
00254 if (found)
00255 continue;
00256 if (logfiles[i].file != NULL)
00257 fclose(logfiles[i].file);
00258 logfiles[i].file = fopen(logfiles[i].filename, "a");
00259 if (logfiles[i].file == NULL) {
00260 error(errno, "Couldn't re-open logfile `%s'.",
00261 logfiles[i].filename);
00262 }
00263 }
00264 }
00265
00266 /*
00267 * Unlock writer.
00268 */
00269 gw_rwlock_unlock(&rwlock);
00270 }
|
Here is the call graph for this function:

|
|
Definition at line 660 of file log.c. References loggable_places, and num_places. Referenced by get_and_set_debugs(). 00661 {
00662 char *p;
00663
00664 p = strtok(gw_strdup(places), " ,");
00665 num_places = 0;
00666 while (p != NULL && num_places < MAX_LOGGABLE_PLACES) {
00667 loggable_places[num_places++] = p;
00668 p = strtok(NULL, " ,");
00669 }
00670 }
|
|
|
Definition at line 202 of file log.c. References filename, info(), and logfiles. Referenced by config_reload(), and httpd_loglevel(). 00203 {
00204 int i;
00205
00206 /* change everything but stderr */
00207 for (i = 0; i < num_logfiles; ++i) {
00208 if (logfiles[i].file != stderr) {
00209 logfiles[i].minimum_output_level = level;
00210 info(0, "Changed logfile `%s' to level `%d'.", logfiles[i].filename, level);
00211 }
00212 }
00213 }
|
Here is the call graph for this function:

|
|
Definition at line 190 of file log.c. References logfiles. Referenced by get_and_set_debugs(), and main(). 00191 {
00192 int i;
00193
00194 for (i = 0; i < num_logfiles; ++i) {
00195 if (logfiles[i].file == stderr) {
00196 logfiles[i].minimum_output_level = level;
00197 break;
00198 }
00199 }
00200 }
|
|
||||||||||||
|
Definition at line 216 of file log.c. References debug(), dosyslog, and sysloglevel. Referenced by get_and_set_debugs(), and init_wapbox(). 00217 {
00218 if (ident == NULL)
00219 dosyslog = 0;
00220 else {
00221 dosyslog = 1;
00222 sysloglevel = syslog_level;
00223 openlog(ident, LOG_PID, LOG_DAEMON);
00224 debug("gwlib.log", 0, "Syslog logging enabled.");
00225 }
00226 }
|
Here is the call graph for this function:

|
|
Definition at line 182 of file log.c. References gw_rwlock_destroy(), log_close_all(), and rwlock. Referenced by gwlib_shutdown(). 00183 {
00184 log_close_all();
00185 /* destroy rwlock */
00186 gw_rwlock_destroy(&rwlock);
00187 }
|
Here is the call graph for this function:

|
|
Definition at line 673 of file log.c. References filename, info(), logfiles, minimum_output_level, thread_slot, and thread_to. Referenced by at2_device_thread(), cgw_listener(), cgw_sender(), emi2_listener(), emi2_sender(), fake_listener(), httpsmsc_receiver(), httpsmsc_send_cb(), io_thread(), smasi_thread(), wrapper_receiver(), and wrapper_sender(). 00674 {
00675 long thread_id = thread_slot();
00676
00677 if (idx > 0)
00678 info(0, "Logging thread `%ld' to logfile `%s' with level `%d'.",
00679 thread_id, logfiles[idx].filename, logfiles[idx].minimum_output_level);
00680 thread_to[thread_id] = idx;
00681 }
|
Here is the call graph for this function:

|
||||||||||||||||