googletest icon indicating copy to clipboard operation
googletest copied to clipboard

[Feature Request]: Event Listener callback for scope enter / leave

Open mbschenkel opened this issue 2 years ago • 1 comments

Describe the issue

We have an extensive logging system around our tests and having the current scope there using SCOPED_TRACE would be nice. Could the enter/leave of a SCOPED_TRACE call 2 new event listeners TestEventListener::OnScopeEnter and TestEventListener::OnScopeLeave?

Steps to reproduce the problem

Currently we have our own SCOPED_TRACE macro that simulates this and falls back to the original ::testing::ScopedTrace.

What version of GoogleTest are you using?

Applies to v1.13.0 (Using v1.10.0)

What operating system and version are you using?

Applies to any (Using Windows)

What compiler and version are you using?

Applies to any (Using clang version 15.0.0)

What build system are you using?

Any (Using SCons)

Additional context

No response

mbschenkel avatar Mar 02 '23 08:03 mbschenkel

Thanks for this request. This seems reasonable, and we would happily accept a pull-request to do this. If you do, please use the names OnScopedTraceEnter and OnScopedTraceExit for the handlers.

asoffer avatar Mar 06 '23 20:03 asoffer