#include <connman/log.h>
int __connman_log_init(const char *program, const char *debug,
- connman_bool_t detach);
-void __connman_log_cleanup(void);
+ connman_bool_t detach, connman_bool_t backtrace);
+void __connman_log_cleanup(connman_bool_t backtrace);
void __connman_log_enable(struct connman_debug_desc *start,
struct connman_debug_desc *stop);
}
int __connman_log_init(const char *program, const char *debug,
- connman_bool_t detach)
+ connman_bool_t detach, connman_bool_t backtrace)
{
static char path[PATH_MAX];
int option = LOG_NDELAY | LOG_PID;
if (detach == FALSE)
option |= LOG_PERROR;
- signal_setup(signal_handler);
+ if (backtrace == TRUE)
+ signal_setup(signal_handler);
openlog(basename(program), option, LOG_DAEMON);
return 0;
}
-void __connman_log_cleanup(void)
+void __connman_log_cleanup(connman_bool_t backtrace)
{
syslog(LOG_INFO, "Exit");
closelog();
- signal_setup(SIG_DFL);
+ if (backtrace == TRUE)
+ signal_setup(SIG_DFL);
g_strfreev(enabled);
}
static gchar *option_wifi = NULL;
static gboolean option_detach = TRUE;
static gboolean option_dnsproxy = TRUE;
+static gboolean option_backtrace = TRUE;
static gboolean option_version = FALSE;
static gboolean parse_debug(const char *key, const char *value,
{ "nodnsproxy", 'r', G_OPTION_FLAG_REVERSE,
G_OPTION_ARG_NONE, &option_dnsproxy,
"Don't enable DNS Proxy" },
+ { "nobacktrace", 0, G_OPTION_FLAG_REVERSE,
+ G_OPTION_ARG_NONE, &option_backtrace,
+ "Don't print out backtrace information" },
{ "version", 'v', 0, G_OPTION_ARG_NONE, &option_version,
"Show version information and exit" },
{ NULL },
g_dbus_set_disconnect_function(conn, disconnect_callback, NULL, NULL);
- __connman_log_init(argv[0], option_debug, option_detach);
+ __connman_log_init(argv[0], option_debug, option_detach,
+ option_backtrace);
__connman_dbus_init(conn);
__connman_dbus_cleanup();
- __connman_log_cleanup();
+ __connman_log_cleanup(option_backtrace);
dbus_connection_unref(conn);
g_test_init(&argc, &argv, NULL);
- __connman_log_init(argv[0], "*", FALSE);
+ __connman_log_init(argv[0], "*", FALSE, TRUE);
__connman_iptables_init();
__connman_nat_init();
__connman_nat_cleanup();
__connman_iptables_cleanup();
- __connman_log_cleanup();
+ __connman_log_cleanup(TRUE);
return err;
}