Exemplo n.º 1
0
LogMessage *
_generate_message_inheriting_properties_from_the_entire_context(CorrellationContext *context)
{
  LogMessage *genmsg = _generate_message_inheriting_properties_from_the_last_message(correllation_context_get_last_message(context));

  log_msg_merge_context(genmsg, (LogMessage **) context->messages->pdata, context->messages->len);
  return genmsg;
}
Exemplo n.º 2
0
static void
test_log_message_merge_with_empty_context(void)
{
    LogMessage *msg, *msg_clone;
    LogMessage *context[] = {};

    msg = construct_log_message_with_all_bells_and_whistles();
    msg_clone = clone_cow_log_message(msg);
    log_msg_merge_context(msg, context, 0);
    log_msg_unref(msg);
    assert_log_messages_equal(msg, msg_clone);
}
Exemplo n.º 3
0
static void
test_log_message_merge_doesnt_overwrite_already_set_values(void)
{
  LogMessage *msg;
  GPtrArray *context = g_ptr_array_sized_new(0);

  msg = construct_merge_base_message();
  g_ptr_array_add(context, construct_merged_message("base", "mergedvalue"));
  log_msg_merge_context(msg, (LogMessage **) context->pdata, context->len);

  assert_log_message_value_by_name(msg, "base", "basevalue");
  g_ptr_array_foreach(context, (GFunc) log_msg_unref, NULL);
  g_ptr_array_free(context, TRUE);
  log_msg_unref(msg);
}
Exemplo n.º 4
0
static void
test_log_message_merge_leaves_base_tags_intact(void)
{
  LogMessage *msg;
  GPtrArray *context = g_ptr_array_sized_new(0);

  msg = construct_merge_base_message();
  g_ptr_array_add(context, construct_merged_message("merged1", "mergedvalue1"));
  log_msg_merge_context(msg, (LogMessage **) context->pdata, context->len);

  assert_log_message_has_tag(msg, "basetag");
  assert_log_message_doesnt_have_tag(msg, "mergedtag");
  g_ptr_array_foreach(context, (GFunc) log_msg_unref, NULL);
  g_ptr_array_free(context, TRUE);
  log_msg_unref(msg);
}
Exemplo n.º 5
0
static void
test_log_message_merge_merges_the_closest_value_in_the_context(void)
{
  LogMessage *msg;
  GPtrArray *context = g_ptr_array_sized_new(0);

  msg = construct_merge_base_message();
  g_ptr_array_add(context, construct_merged_message("merged", "mergedvalue1"));
  g_ptr_array_add(context, construct_merged_message("merged", "mergedvalue2"));
  log_msg_merge_context(msg, (LogMessage **) context->pdata, context->len);

  assert_log_message_value_by_name(msg, "merged", "mergedvalue2");
  g_ptr_array_foreach(context, (GFunc) log_msg_unref, NULL);
  g_ptr_array_free(context, TRUE);
  log_msg_unref(msg);
}