void gda_transaction_status_dump (GdaTransactionStatus *tstatus, guint offset) { gchar *str; GList *evlist; gchar *levels[] = {"GDA_TRANSACTION_ISOLATION_UNKNOWN", "GDA_TRANSACTION_ISOLATION_READ_COMMITTED", "GDA_TRANSACTION_ISOLATION_READ_UNCOMMITTED", "GDA_TRANSACTION_ISOLATION_REPEATABLE_READ", "GDA_TRANSACTION_ISOLATION_SERIALIZABLE"}; #define level_str(lev) ((lev < 4) ? levels[lev] : "UNKNOWN ISOLATION LEVEL") g_return_if_fail (GDA_IS_TRANSACTION_STATUS (tstatus)); str = g_new (gchar, offset+1); memset (str, ' ', offset); str [offset] = 0; g_print ("%sGdaTransactionStatus: %s (%s, %p)\n", str, tstatus->name ? tstatus->name : "(NONAME)", level_str (tstatus->isolation_level), tstatus); for (evlist = tstatus->events; evlist; evlist = evlist->next) { GdaTransactionStatusEvent *ev = (GdaTransactionStatusEvent *) (evlist->data); switch (ev->type) { case GDA_TRANSACTION_STATUS_EVENT_SAVEPOINT: g_print ("%s *SAVE POINT %s (%p)\n", str, ev->pl.svp_name, ev); break; case GDA_TRANSACTION_STATUS_EVENT_SQL: g_print ("%s *SQL %s (%p): %s\n", str, ev->pl.sql, ev, ev->conn_event ? gda_connection_event_get_description (ev->conn_event) : "_no event_"); break; case GDA_TRANSACTION_STATUS_EVENT_SUB_TRANSACTION: g_print ("%s *SUB TRANSACTION (%p)\n", str, ev); gda_transaction_status_dump (ev->pl.sub_trans, offset + 5); break; default: g_assert_not_reached (); } } g_free (str); }
static void log_check_env(void) { _log_level = LOG_LEVEL_DEFAULT; const char *levelstr = level_str(getenv(LOG_LEVEL_ENV)); const char *outputstr = output_str(getenv(LOG_OUTPUT_ENV)); const char *timestr = time_str(getenv(LOG_TIMESTAMP_ENV)); int level = atoi(levelstr); int output = atoi(outputstr); int timestamp = atoi(timestr); switch (level) { case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: _log_level = level; break; case 0: if (is_str_equal(levelstr, "error")) { _log_level = LOG_ERR; } else if (is_str_equal(levelstr, "warn")) { _log_level = LOG_WARNING; } else if (is_str_equal(levelstr, "notice")) { _log_level = LOG_NOTICE; } else if (is_str_equal(levelstr, "info")) { _log_level = LOG_INFO; } else if (is_str_equal(levelstr, "debug")) { _log_level = LOG_DEBUG; } else if (is_str_equal(levelstr, "verbose")) { _log_level = LOG_VERB; } break; default: break; } switch (output) { case 1: case 2: case 3: case 4: _log_output = output; break; case 0: if (is_str_equal(outputstr, "stderr")) { _log_output = LOG_STDERR; } else if (is_str_equal(outputstr, "file")) { _log_output = LOG_FILE; } else if (is_str_equal(outputstr, "rsyslog")) { _log_output = LOG_RSYSLOG; } break; default: break; } switch (timestamp) { case 1: UPDATE_LOG_PREFIX(_log_prefix, LOG_TIMESTAMP_BIT); break; case 0: if (is_str_equal(timestr, "y") || is_str_equal(timestr, "yes") || is_str_equal(timestr, "true")) { UPDATE_LOG_PREFIX(_log_prefix, LOG_TIMESTAMP_BIT); } break; default: break; } if (_log_level == LOG_DEBUG) { UPDATE_LOG_PREFIX(_log_prefix, LOG_FUNCLINE_BIT); } if (_log_level == LOG_VERB) { UPDATE_LOG_PREFIX(_log_prefix, LOG_VERBOSE_BIT); } }