Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Can i disable ABSL_* facilities?

55 views
Skip to first unread message

Vanegicloh J

unread,
Oct 16, 2024, 7:11:52 AM10/16/24
to Protocol Buffers
Hello.

I use C++ protobuf Message and LiteMessage classes. I'm a bit concerned about ABSL macros. As i understand ABSL_LOG(FATAL) and ABSL_CHECK_* macros will terminate the program. For my app it's unacceptable to terminate. Could you please make it clear:

1. Is it possible to disable or change the behavior of ABSL_LOG(FATAL) and ABSL_CHECK_* macros?
2. Does protobuf API have some extension points for logging? In my app i have custom logging system.
3. Should i be concerned about this macros in Message and LiteMessage classes? Or it's unlikely that i will ever face them (and further termination)?

Thank you.

Em Rauch

unread,
Oct 21, 2024, 12:05:05 PM10/21/24
to Vanegicloh J, Protocol Buffers
>  1. Is it possible to disable or change the behavior of ABSL_LOG(FATAL) and ABSL_CHECK_* macros?
3. Should i be concerned about this macros in Message and LiteMessage classes? Or it's unlikely that i will ever face them (and further termination)?

Protobuf only uses these panic macros sparingly in places would mean we're in a "should be impossible" and unrecoverable state, potentially from corruption by the application code invoking C++ Undefined Behavior, or (more rarely) a severe bug the Protobuf code itself. They are not intended to be hit in the normal course of execution of a program unless there's a very severe bug happening, eg, a parse() on any arbitrary bytes is intended to never reach one of these panics, it will always gracefully succeed or fail.

You could vendor either protobuf or absl into your repository and change the behavior of these macros, but we wouldn't recommend it since if those would ever be reached something is very wrong and the realistically the only things that could happen if you continue execution is either a crash immediately afterwards or else data corruption.

2. Does protobuf API have some extension points for logging? In my app i have custom logging system.

ABSL allows for integrating into your own custom logging system with absl::LogSink; it lets you do that at a global level which you can use for this context.

--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/126cd1cb-1ead-47dc-9a55-6b5b685731dbn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages