Modify the logging guards for platform builds. This is a backport of cl/651771160. Change-Id: I455bfa80e208457487cd9b5fc247122978cb64d2