コード例 #1
0
void
gst_debugserver_log_send_log (GstDebugserverLog * log,
    GstDebugserverTcp * tcp_server, GstDebugCategory * category,
    GstDebugLevel level, const gchar * file, const gchar * function, gint line,
    GObject * object, GstDebugMessage * message)
{
  GstDebugger__GStreamerData gst_data = GST_DEBUGGER__GSTREAMER_DATA__INIT;
  GstDebugger__LogInfo log_info = GST_DEBUGGER__LOG_INFO__INIT;

  log_info.level = (gint) level;
  log_info.category = (gchar *) gst_debug_category_get_name (category);
  log_info.file = (gchar *) file;
  log_info.function = (gchar *) function;
  log_info.line = line;

  if (GST_IS_OBJECT (object)) {
    log_info.object = GST_OBJECT_NAME (object);
  } else {
    log_info.object = (gchar *) G_OBJECT_TYPE_NAME (object);
  }

  log_info.message = (gchar *) gst_debug_message_get (message);

  gst_data.info_type_case = GST_DEBUGGER__GSTREAMER_DATA__INFO_TYPE_LOG_INFO;
  gst_data.log_info = &log_info;

  gst_debugserver_hooks_send_data (&log->hooks, tcp_server, &gst_data);
}
コード例 #2
0
ファイル: owr.c プロジェクト: bill-auger/openwebrtc
static void gst_log_android_handler(GstDebugCategory *category,
                 GstDebugLevel level,
                 const gchar *file,
                 const gchar *function,
                 gint line,
                 GObject *object,
                 GstDebugMessage *message,
                 gpointer data)
{
    gchar *obj = NULL;

    OWR_UNUSED(data);

    if (level > gst_debug_category_get_threshold(category))
      return;

    if (GST_IS_PAD(object) && GST_OBJECT_NAME(object)) {
      obj = g_strdup_printf("<%s:%s>", GST_DEBUG_PAD_NAME(object));
    } else if (GST_IS_OBJECT(object)) {
      obj = g_strdup_printf("<%s>", GST_OBJECT_NAME(object));
    }

    __android_log_print(ANDROID_LOG_INFO, "gst_log", "%p %s %s %s:%d:%s:%s %s\n",
            (void *)g_thread_self(),
            gst_debug_level_get_name(level), gst_debug_category_get_name(category),
            file, line, function, obj ? obj : "", gst_debug_message_get(message));

    g_free(obj);
}
コード例 #3
0
ファイル: log.c プロジェクト: i4tv/gstreamill
static void log_func (GstDebugCategory *category,
        GstDebugLevel level,
        const gchar *file,
        const gchar *function,
        gint line,
        GObject *object,
        GstDebugMessage *message,
        gpointer user_data)
{
    Log *log = (Log *)user_data;
    GDateTime *datetime;
    gchar *date;
    const gchar *cat;

    if (level > gst_debug_category_get_threshold (category)) {
        return;
    }

    cat = gst_debug_category_get_name (category);
    datetime = g_date_time_new_now_local ();
    if (g_strcmp0 (cat, "access") == 0) {
        date = g_date_time_format (datetime, "%b/%d/%Y:%H:%M:%S %z");
        fprintf (log->access_hd, gst_debug_message_get (message), date);
        g_free (date);
        fflush (log->access_hd);

    } else {
        date = g_date_time_format (datetime, "%b %d %H:%M:%S");
        fprintf (log->log_hd, "%s.%d %s" CAT_FMT "%s\n",
            date,
            g_date_time_get_microsecond (datetime),
            gst_debug_level_get_name (level),
            cat, file, line,
            gst_debug_message_get (message));
        g_free (date);
        fflush (log->log_hd);
    }
    g_date_time_unref (datetime);
}
コード例 #4
0
static void
check_gst_log_handler (GstDebugCategory * category,
    GstDebugLevel level, const gchar * file, const gchar * function, gint line,
    GObject * object, GstDebugMessage * _message, gpointer data)
{
  const gchar *message = gst_debug_message_get (_message);
  gchar *msg, *obj_str;
  const gchar *level_str, *cat_str;
  GstClockTime elapsed;

  //-- check message contents
  if (__check_method && (strstr (function, __check_method) != NULL)
      && __check_test && (strstr (message, __check_test) != NULL))
    __check_error_trapped = TRUE;
  else if (__check_method && (strstr (function, __check_method) != NULL)
      && !__check_test)
    __check_error_trapped = TRUE;
  else if (__check_test && (strstr (message, __check_test) != NULL)
      && !__check_method)
    __check_error_trapped = TRUE;

  if (level > gst_debug_category_get_threshold (category))
    return;

  elapsed =
      GST_CLOCK_DIFF (_priv_bt_info_start_time, gst_util_get_timestamp ());
  level_str = gst_debug_level_get_name (level);
  cat_str = gst_debug_category_get_name (category);
  if (object) {
    if (GST_IS_OBJECT (object)) {
      obj_str = g_strdup_printf ("<%s,%" G_OBJECT_REF_COUNT_FMT ">",
          GST_OBJECT_NAME (object), G_OBJECT_LOG_REF_COUNT (object));
    } else if (GST_IS_OBJECT (object)) {
      obj_str = g_strdup_printf ("<%s,%" G_OBJECT_REF_COUNT_FMT ">",
          G_OBJECT_TYPE_NAME (object), G_OBJECT_LOG_REF_COUNT (object));
    } else {
      obj_str = g_strdup_printf ("%p", object);
    }
  } else {
    obj_str = g_strdup ("");
  }

  msg = g_alloca (95 + strlen (cat_str) + strlen (level_str) + strlen (message)
      + strlen (file) + strlen (function) + strlen (obj_str));
  g_sprintf (msg,
      "%" GST_TIME_FORMAT " %" PID_FMT " %" PTR_FMT " %-7s %20s %s:%d:%s:%s %s",
      GST_TIME_ARGS (elapsed), getpid (), g_thread_self (),
      level_str, cat_str, file, line, function, obj_str, message);
  g_free (obj_str);
  check_print_handler (msg);
}
コード例 #5
0
ファイル: gstinfo.c プロジェクト: AlerIl/gstreamer0.10
static void
printf_extension_log_func (GstDebugCategory * category,
    GstDebugLevel level, const gchar * file, const gchar * function,
    gint line, GObject * object, GstDebugMessage * message, gpointer unused)
{
  const gchar *dbg_msg;

  dbg_msg = gst_debug_message_get (message);
  fail_unless (dbg_msg != NULL);

  /* g_print ("%s\n", dbg_msg); */

  /* quick hack to still get stuff to show if GST_DEBUG is set */
  if (g_getenv ("GST_DEBUG")) {
    gst_debug_log_default (category, level, file, function, line, object,
        message, unused);
  }
}
コード例 #6
0
void LLMediaImplGStreamer::gstreamer_log(GstDebugCategory *category,
                                         GstDebugLevel level,
                                         const gchar *file,
                                         const gchar *function,
                                         gint line,
                                         GObject *object,
                                         GstDebugMessage *message,
                                         gpointer data)
{
	std::stringstream log(std::stringstream::out);

	// Log format example:
	// 
	// GST_ELEMENT_PADS: removing pad 'sink' (in gstelement.c:757:gst_element_remove_pad)
	// 
	log << gst_debug_category_get_name( category ) << ": "
	    << gst_debug_message_get(message) << " "
	    << "(in " << file << ":" << line << ":" << function << ")";

	switch( level )
	{
		case GST_LEVEL_ERROR:
			LL_WARNS("MediaImpl") << "(ERROR) " << log.str() << LL_ENDL;
			break;
		case GST_LEVEL_WARNING:
			LL_WARNS("MediaImpl") << log.str() << LL_ENDL;
			break;
		case GST_LEVEL_DEBUG:
			LL_DEBUGS("MediaImpl") << log.str() << LL_ENDL;
			break;
		case GST_LEVEL_INFO:
			LL_INFOS("MediaImpl") << log.str() << LL_ENDL;
			break;
		default:
			// Do nothing.
			break;
	}
}
コード例 #7
0
static void gst_debug_gub(GstDebugCategory * category, GstDebugLevel level,
    const gchar * file, const gchar * function, gint line,
    GObject * object, GstDebugMessage * message, gpointer unused)
{
    GstClockTime elapsed;
    gchar *tag;
    const gchar *level_str;

    if (level > gst_debug_category_get_threshold(category))
        return;

    elapsed = GST_CLOCK_DIFF(_priv_gst_info_start_time,
        gst_util_get_timestamp());

    switch (level) {
    case GST_LEVEL_ERROR:
        level_str = "ERR";
        break;
    case GST_LEVEL_WARNING:
        level_str = "WRN";
        break;
    case GST_LEVEL_INFO:
        level_str = "NFO";
        break;
    case GST_LEVEL_DEBUG:
        level_str = "DBG";
        break;
    default:
        level_str = "LOG";
        break;
    }

    tag = g_strdup_printf("%s", gst_debug_category_get_name(category));

    if (object) {
        gchar *obj;

        if (GST_IS_PAD(object) && GST_OBJECT_NAME(object)) {
            obj = g_strdup_printf("<%s:%s>", GST_DEBUG_PAD_NAME(object));
        }
        else if (GST_IS_OBJECT(object) && GST_OBJECT_NAME(object)) {
            obj = g_strdup_printf("<%s>", GST_OBJECT_NAME(object));
        }
        else if (G_IS_OBJECT(object)) {
            obj = g_strdup_printf("<%s@%p>", G_OBJECT_TYPE_NAME(object), object);
        }
        else {
            obj = g_strdup_printf("<%p>", object);
        }

        gub_log(
            "%" GST_TIME_FORMAT " %p %s %s %s:%d:%s:%s %s",
            GST_TIME_ARGS(elapsed), g_thread_self(), level_str, tag,
            file, line, function, obj, gst_debug_message_get(message));

        g_free(obj);
    }
    else {
        gub_log(
            "%" GST_TIME_FORMAT " %p %s %s %s:%d:%s %s",
            GST_TIME_ARGS(elapsed), g_thread_self(), level_str, tag,
            file, line, function, gst_debug_message_get(message));
    }
    g_free(tag);
}