def test_request_id_tag__new_processor(self): self.assertEquals(get_tag(), None) tag = return_tag_func() self.assertIsNotNone(tag) self.assert_log_records_len(1) self.assert_any_log_record(lambda r: get_request_id_tag_from_record(r) == tag)
def test_request_id_tag__new_processor(self): self.assertEquals(get_tag(), None) tag = return_tag_func() self.assertIsNotNone(tag) self.assert_log_records_len(1) self.assert_any_log_record( lambda r: get_request_id_tag_from_record(r) == tag)
def test_request_id_tag__context_switch_new_tag(self): set_tag('boo') g = gevent.spawn(return_tag_func_2) g.join() tag = g.value self.assertNotEquals(tag, 'boo') self.assert_log_records_len(1) self.assert_any_log_record(lambda r: get_request_id_tag_from_record(r) == tag and 'return_tag_func_2' in r.msg)
def test_request_id_tag__context_switch_set_tag(self): set_tag('boo') def foo(): return return_tag_func() g = gevent.spawn(request_id_tag(foo, tag='boo2')) g.join() self.assertEquals(g.value, 'boo2') self.assert_log_records_len(1) self.assert_any_log_record(lambda r: get_request_id_tag_from_record(r) == 'boo2' and 'foo' in r.msg)
def test_request_id_tag__log_only_first_tag_ctx(self): tag = return_tag_func_2() self.assert_log_records_len(1) self.assert_any_log_record(lambda r: get_request_id_tag_from_record(r) == tag and 'return_tag_func_2' in r.msg)