-
Notifications
You must be signed in to change notification settings - Fork 2k
Switch filament and backend to Abseil logging #8691
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Will you be able to check how this affect the binary size on a release build? |
Yes, I'm planning on check that. Unfortunately I think Abseil log uses std iostream, so we may see a binary size increase. |
@@ -772,26 +774,25 @@ UTILS_NOINLINE | |||
} else { | |||
line = shader.substr(start, end - start); | |||
} | |||
out << lc++ << ": " << line.c_str() << '\n'; | |||
LOG(ERROR) << lc++ << ": " << line.c_str(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this should be a utils/std::stream, and then output to LOG(ERROR) at the end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I thought about that. The difference is that with LOG(ERROR)
, Abseil prepends metadata for each line. I guess we have to decide which style we prefer.
0585a5d
to
3359ef4
Compare
I'm seeing a 208.84 KiB binary size increase on Android. jni/arm64-v8a/libfilament-jni.so:
|
3359ef4
to
bd1cfba
Compare
LogLine& operator=(const LogLine&) = delete; | ||
LogLine& operator=(LogLine&&) = delete; | ||
|
||
~LogLine() noexcept { mStream << utils::io::endl; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The semantics here is a little different from the old since it'll be flushed when the LogLine goes out of scope, as oppose to when <<utils::io::endl
is used in the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe that's ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the semantics are indeed different. I did my best to find all the places we weren't using utils::io::endl
and instead use a stringstream
first to concatenate. IMO the way we did it explicitly with utils::io::endl
is a better API, but this is just how Abseil works. I really wish Abseil had a LOG_NOENDLINE
-style macro, but it doesn't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm but web build seems to be failing
This switches everything under
filament/
to Abseil logging. The following mapping betweenutils::slog
and Abseil severity is used: