feat utest: introduce LoggingFixture#1143
feat utest: introduce LoggingFixture#1143Turim wants to merge 2 commits intouserver-framework:developfrom
Conversation
| } | ||
| }; | ||
|
|
||
| } // namespace detail |
There was a problem hiding this comment.
Btw I'm not sure, but may be if we provide LoggingFixtureEx along with, we'd better get LoggingFixtureEnvironment outta detail namespace?
|
|
||
| void Log(logging::Level level, logging::impl::formatters::LoggerItemRef item) override | ||
| { | ||
| UASSERT(dynamic_cast<logging::impl::TextLogItem*>(&item)); |
There was a problem hiding this comment.
Not sure here also: may be it's enough to check via static_cast on the next line.
|
|
||
| namespace detail { | ||
|
|
||
| class CoutLogger final : public logging::impl::TextLogger { |
There was a problem hiding this comment.
What do you think, is it decent to propose logger change: get TextLogger out of the impl namespace?
The assumed downside: might be there would be a client which would use the class on a regular basis..
| { | ||
| LOG_INFO() << "Test message"; | ||
| } | ||
|
|
There was a problem hiding this comment.
Shall we provide an example on DerivedEnvironment or the usage is obvious?
|
I have no clue about the build issue( e.g. gRPC? re2? it seems unrelated to me. |
|
Looks like the command line option @Turim Am I missing something? |
|
Hi, Antony,
Might be I'm shortened the Motivation, so I'll try to clarify here then:
So, on the one hand, I'm not sure (you'd better clarify, please) if the mentioned logger-tests-sink are appropriate to be shared across the userver-core-unittest and abroad in the userver testing scenario. (from the 1st glance they are not) On the other hand, when some dev wants to see (=print, log) userver's (and/or written via userver) structures in it's own tests, he doesn't have the option other than to write a logger sink (=e.g. reinvent the fixture somehow) (Hopefully it's possible today at all - please, if possible, don't drop this option, I've mentioned about the impl:: namespace above) |
| CoutLogger() : TextLogger(logging::Format::kTskv) | ||
| { | ||
| #if 0 | ||
| // Actually in the case we see some manipulation with the level and in the end it doesn't work expected way |
There was a problem hiding this comment.
Seems to me that 1. on --trace_level=debug
[ RUN ] LoggingFixture.DebugMessage
tskv timestamp=2026-03-17T23:51:21.289074 level=INFO module=Start ( core/src/engine/coro/stack_usage_monitor.cpp:319 ) task_id=0 thread_id=0x0000748B659FBC00 text=Successfully initialized StackUsageMonitor, kernel supports following userfaultfd features: 131071
tskv timestamp=2026-03-17T23:51:21.289432 level=DEBUG module=AcquireEvDefaultLoop ( core/src/engine/ev/event_loop.cpp:36 ) task_id=0 thread_id=0x0000748B659FBC00 text=Acquire ev_default_loop for thread_name=userver-utest-u
tskv timestamp=2026-03-17T23:51:21.289530 level=INFO module=StateBase ( core/src/engine/deadlock_detector.cpp:129 ) task_id=0 thread_id=0x0000748B659FBC00 text=Deadlock detector is disabled, stacktraces collection is disabled
tskv timestamp=2026-03-17T23:51:21.289615 level=INFO module=TaskProcessor ( core/src/engine/task/task_processor.cpp:143 ) task_id=0 thread_id=0x0000748B659FBC00 text=creating task_processor worker_threads=1 thread_name=coro-runner
128142014411776 debug tskv timestamp=2026-03-17T23:51:21.300360 level=DEBUG module=TestBody ( core/utest/src/utest/logging_fixture_test.cpp:13 ) text=Test message
we see a lot of implementation details (e.g. TaskProcessor/thread/loop)
There was a problem hiding this comment.
- on --trace_level=info it works unexpected way. So I'd better leave unconfigured kDebug for the case.
What do you think?
Motivation:
Note: by creating a PR or an issue you automatically agree to the CLA. See CONTRIBUTING.md. Feel free to remove this note, the agreement holds.